Tinting buttons by iteration

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

Tinting buttons by iteration

Postby dantronic » Wed Mar 11, 2020 6:23 pm

Hi there,

I'm running a routine where you press one of a set of buttons, it turns that one green and the rest purple.
It relies on iterating through the button IDs, though, and keeping a sequence of consecutive IDs for these buttons has been problematic.

Adding buttons to the sequence... for a number of reasons can't keep them in sequence.

So is there a better way folks have done this whole idea? Seems like would be in common use

Thanks!
dan
You do not have the required permissions to view the files attached to this post.
---
Dan Ribaudo
dantronic
 
Posts: 15
Joined: Sun Feb 22, 2009 9:06 pm
Location: St Louis Missouri, USA

Re: Tinting buttons by iteration

Postby malkuth23 » Thu Mar 12, 2020 8:12 am

Hey Dan!

I am a bit confused and maybe I am misunderstanding your ask.
But I will pretend like I understand and say words that are 50% likely to not be helpful to you.

Here is what I usually do.
I create a macro or function that turns everything purple, then it turns the one you pressed green.
In the macro there would be clever for loops if they can exist, or you can copy and paste the command x number of times and just modify the button ids.
Either way, it works.

I also like to send a block of widgets into a different power of 10. So all my buttons will be 1001,1002 etc, which keeps me out of the garbage I made earlier.

When you say sequence, do you mean keep them in a row in WD or apply them to a PB sequence in some way?

Anyway, like I said, not sure I was helpful at all, but call me up sometime brother and we will invent a super-convoluted way to do this that we will never share with anyone because of it's complete absurdity.

Matt
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 354
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: Tinting buttons by iteration

Postby malkuth23 » Thu Mar 12, 2020 8:21 am

Oh wait. Maybe I got it.

Context.WidgetID - This will get you your buttonID. As long as you keep all the buttons in a reserved range say 1000-20000, then you run a loop to make them all purple, then use the context.widgerID to make the special button pink or whatever color you wanted.

If you really need a hard list, I think you could use this to make a list by putting the code in each button and press them and then have them send their ID to a list variable. Then you could just run down the list variable make each button rainbowtastic.
Matthew Newman-Saul
Theatrical Concepts
mattns@theatrical.com
User avatar
malkuth23
 
Posts: 354
Joined: Tue Apr 20, 2010 7:14 pm
Location: New Orleans, LA

Re: Tinting buttons by iteration

Postby Justyn Roy » Thu Mar 12, 2020 4:21 pm

There are two ways I usually do this:

Method 1:

Set an array with all of your button IDs:

Code: Select all
Var ButtonList = [113,114,115,229,230...]

For i = 0 to ButtonList.Count - 1 {
    WDCustomScriptTint(i,255,0,255)
}


This way, you can easily add more buttons to that list in the top line, and the loop will automatically expand or shrink with that list.

Method 2:

Change the title of each of those buttons because the label can be different from the ID!:
Button 1 would be: MyNameHere_101 / MyNameHere_102

Then your script could be like this:
Code: Select all
Var NumOfButton = 100

For i = 101 to 101 + NumOfButton {
    Project.CustomScript("MyNameHere_" + i).SetTint(R,G,B)
}



Method 1 is probably the easiest now that you've already got a project on the go.

Let me know if that helps!
Justyn Roy
Solutions Architect
Christie Digital Systems

Online Manual
User avatar
Justyn Roy
 
Posts: 96
Joined: Tue Sep 27, 2016 1:26 am

Re: Tinting buttons by iteration

Postby Benni_M » Thu Mar 12, 2020 9:13 pm

Hi Dan,

here is another solution with less performance.

create a integer variable e.g. var_last_tint.

Code: Select all
WDCustomScriptTint(var_last_tint,255,0,255)
var_last_tint = Context.WidgetID
WDCustomScriptTint(var_last_tint,0,0,255)


this code you have to add in all buttons or to a macro and pass the ID in the macro.

pros are that you don't have to think about button IDs ... and it's faster because you tint just 2 buttons all the time...
and you can easily create groups. You just have to change the variable.

Best,
Benni
Benni_M
 
Posts: 141
Joined: Thu Apr 12, 2012 3:45 pm

Re: Tinting buttons by iteration

Postby dantronic » Fri Mar 13, 2020 2:51 pm

These are all great options thanks guys!

Inevitably they account for the non-consecutive nature of the IDs, which was the obstacle.

Trying to use re-use IDs from old deleted buttons -> wierd behavior, so a list or macro is the way to go
---
Dan Ribaudo
dantronic
 
Posts: 15
Joined: Sun Feb 22, 2009 9:06 pm
Location: St Louis Missouri, USA


Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 5 guests

cron