Buttons / Switches to imitate Cubase's toolbox

Here's the deal...

I'm "re-building" Cubase's toolbox :

Now, i have made two of it:

  • one set of 14 buttons, toggle mode (differents backgrounds depending on button's value)
  • one 14 value's switch (same thing with backgrounds).

First questions (more to come :smiley: ):

  • i know how to turn off a button, using another one. But in this case, i need each button to turn off the 13 others... Or at least the one that would have been turned on just before... In one word : i need my 14 buttons to act like a switch... How can i do that ?... I can imagine a few things, but i'm too new to OSC to script this...

Thank you

Hi Sylvain,

You can try it out by inserting the following script on your first button, I will call it button_1 for this example:

//1 is the value of button_1
if (value == 1) {

//When button_1 is toggled, button_2 and button_3 will turn off
set ("button_2", 0)
set ("button_3", 0)
//etc...
}

The rest of the work is logical :slightly_smiling_face:

Swayrian

1 Like

Thank you Swayrian.

Isn't there a way to make it shorter ?... Like some syntax that would mean "get all the other buttons in this panel and set them all to zero" (using a variable, especially if their names have a number).

Probably what you could do is to create a button outside of the panel, which I guess has already 14 buttons ?
In any case, that external button will switch all the buttons you have in the panel to on/off when you toggle it and this can be done by using linkId.

That's the shortest solution I can think of right now but if something else pop up I will let you know !

Swayrian

Like some syntax that would mean "get all the other buttons in this panel and set them all to zero" (using a variable, especially if their names have a number).

set("button_*", 0, {sync: false})

Scripting - Open Stage Control

Hmmm... got some issue there...

So i've some buttons in the same panel, b2 and b3 (in fact, i have a bit more of them):
set

In their "script menu" : set("b*",0, {sync:false});
b2 turns of b3, and b3 turns off b2, that seems to be ok as the widgets alpha changes.

Here I have two text widgets set to value : @{b2} for the first one, value : @{b3} for the second one.
Values changes are shown as expected when buttons are turned of/off individually.

But...

The thing is that when a button is turned off by another, it's value appears to stay "1" as show the text widget...

Also, if i try with two background images for each button, using in css field :

#{@{this}==1 ? "background:url(Images/imageON.png)" : "background:url(Images/imageOFF.png)"};

the background change is made when i press the button, but as soon as the other button is turned on, the background image of the first one stays the same, on "image ON"...

Hope i'm clear... so... what's wrong here ?... do i misunderstand anything ? or is there something not working ?

Thank you :slight_smile:

This works great... however, when I add a midi target:

"midi:loopbe" in the "osc -> target" field, the buttons wont stay "active / toggled" when i press them (they become unpressed immediately).
What could be causing that?

I solved it myself. I had mapped the midi ports incorrectly so that I was getting back the same message that I sent, which triggered the button again!

Hi there !

Still having the same strange color / background behaviour : they don't follow the buttons values...

I don't know what i'm missing here...

So, here are 4 examples of what i tried to do to solve this problem :
Buttons as Switches, with backgrounds.json (21.2 KB)

Thanks for help :wink:

With {sync: false} in the set() call, the value change is not propagated to the colorWidget property, that's a limitation I'll need to tinker with.

Edit: {script: false} will allow preventing only the scripts (and keep other sync mechanisms intact) in next version.

1 Like

Thank you :+1: