Possible to switch multiple toggles at the same time?

if I have 10 toggle swithes and they all do something but then I want to do smaller presets like for example Preset 1 being Toggle 1,4 & 8 on and another preset where 2, 5 & 9 are on, is that possible?
thank you!

You can create a button that sets multiple widgets at once with its script property and the set() function.

@jean-emmanuel can you give us a little example.

it is different from @Alex.Vartzbed

1.) i have a menu widget (with json values)
2.) in a panel i want to show some buttons (and hide otheres ), depending on the menu selection
3.) the value of the panel widget is updated with @{panelname.value}

I want to hide (visible and interaction set to false) or show some buttons in the panel depending on its value.

Can you give me some codesnippets for this (i guess a custom module is the best solution here -> i couldn’t execute a script on value change, some easy examples would be helpful here too)

Thanks!

// setting multiple widgets from a single script
set("widget_a", 1)
set("widget_b", 0)
set("widget_c", 1)
// etc

in a panel i want to show some buttons (and hide otheres ), depending on the menu selection

What I do usually is simply to define each widget’s visible property with conditional statements (if visible is false there is no need to change interactive);

#{@{switch_id} == 0}

This will return true if the switch’s value is 0, false otherwise. It’s possible to combine multiple conditions:

#{@{switch_id} == 0 && @{button_id} == 1}

3.) the value of the panel widget is updated with @{panelname.value}

I’m not sure what you mean by this, but anyway:

  • @{panelname.value}: the “.value” part is not needed
  • panels can’t store arbitrary values, their value is only of use if they contain tabs, in which case it’s used to define which tab is selected.

thanks for the examples, still don’t get it how to use the script property…( assume having menu xxx, and matrix yyy, and then in the script property of xxx, i write in get(“yyy”,height) -> ???)

Because of another forum question:

i decided to go with a matrix object.
With a menu i switch 4 categories, depending on the selection the corresponding matrix is showing up.

Now the Menu should stick to the matrix (the height differs)
Menu selection A -> get the height of Matrix A, Menu B -> height of Matrix B

in the menu top property i tried:

#{ if (@{collType.value == E-HEAVY}) {
return @{E-HEAVY.height}
}
if (@{…}) {
return @{xxxx.height}
}
}

thanks!

#{ if (@{collType.value == E-HEAVY}) {

You can’t use #{} this way, you must use the JS{{}} block if you don’t wan’t your code to be prepended with a return statement automatically (which makes your code invalid). See https://openstagecontrol.ammd.net/docs/widgets/advanced-syntaxes/#javascript-code

Also, the statement “@{collType.value == E-HEAVY}” doesnt comply with the syntax rules described in the documention, I think what you wanted to write was something like

JS{{
if (@{collType} == "E-HEAVY") {
  return @{E-HEAVY.height}
}
}}