Creating an "active" button in WD

Moderator: Moderator Group

Creating an "active" button in WD

Postby ppfer » Sat May 31, 2014 12:05 pm

Hello,
in my last show I used Widget Designer STD to completely control PB.

Just to simplify, I had a group of buttons to jump between cues in the timeline.

I programmed each button to become green when pressed so I could have a visual feedback of which cue was active without looking at the PB timeline. Obviously, the previous active button turned back to grey.

To achieve this I programmed the button to change its color to green and then to change the color of other buttons in the group to grey.

I had many cues so when the show director asked me to add some new cue I had to manually change the programming of each button in the group. It was not a problem but I’d like to understand if there is a faster / clever way to achieve a “visual feedback” for an active cue or content using custom scripts in WD STD.
ppfer
 
Posts: 15
Joined: Thu Jan 16, 2014 1:10 am

Re: Creating an "active" button in WD

Postby jmusarra » Sat May 31, 2014 4:48 pm

Code: Select all
Hi, ppfer.
I just finished up writing a button toggle/highlight system that might work for you. It uses an integer array to keep track of the selection state of things - in my case, it's projectors, but I think it'd work as well for cues or sequences.

My array (selectedProjectors) is just 1 and 0 values, and there are two functions that act on it - toggleSelection{}, which takes the ID of the button and toggles whether that value in the array is a 1 or a 0, and highlight{}, which reads through the array and sets the text colors of the associated buttons - in my case, red indicates selected and boring gray is unselected.

I first initialize the array:
Code: Select all
VDelete,selectedProjectors
VIntArray,selectedProjectors,0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0

That gives me 19 objects, each representing a projector, and all in the unselected (0) state.

Here's toggleSelection{}:
Code: Select all
VGetArrayValue,j,pj,selectedProjectors

if j = 1
{
VSetArrayValue,selectedProjectors,pj,0
}
else
{
VSetArrayValue,selectedProjectors,pj,1
}
highlight{}


This just checks the value of an item in the array (at the position indicated by the parameter 'pj'). If it's a zero, it changes it to a 1, and vice versa, and then runs the highlight{} function on the array. The 'pj' parameter is passed to the function from the button's code, and is equal to the button's ID.



and highlight{}:
Code: Select all
i=1
for 1 to 19
VGetArrayValue,j,i,selectedProjectors
if j = 1
{
WDCustomScriptTextColour,i,255,0,0
}
else
{
WDCustomScriptTextColour,i,128,128,128
}
i+=1
next


Where this setup saves time is that the code for each button is the same:
Code: Select all
toggleSelection{myID}


Two caveats - the buttonIDs need to match their respective object's position in the array (I didn't think of this soon enough, and have so they're all numbered 100 higher, and there's code to add/subtract 100 from everything. Messy and annoying.), and this allows for the selection of multiple things - desirable in my application, but probably less so when it comes to playing cues or sequences. Maybe instead of an array, just run highlight{MyID} in each of your buttons?
jmusarra
 
Posts: 1
Joined: Fri Feb 24, 2012 3:10 am
Location: Las Vegas, NV, USA

Re: Creating an "active" button in WD

Postby Dennis Kuypers » Sun Jun 01, 2014 1:44 pm

Hey,

Here is a way that works only when all buttons are in one range (there should be no other buttons between the first and the last button id of the group).

http://forum.coolux.de/viewtopic.php?f=80&t=3253&p=9585&hilit=myid#p9585

You can probably extend this to use functions and a array to have arbitrary button ids.

Best regards
Dennis
Dennis Kuypers
(former Product Developer, Software)
Dennis Kuypers
coolux Germany
 
Posts: 771
Joined: Thu Jul 05, 2012 12:18 pm

Re: Creating an "active" button in WD

Postby ppfer » Sun Jun 01, 2014 3:00 pm

Thanks both of you!
I guess I should try it on WD Pro... Very nice solutions by the way...
ppfer
 
Posts: 15
Joined: Thu Jan 16, 2014 1:10 am


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 24 guests

cron