Hi all,
is there a way to send a custom OSC message when a tab is selected instead of the the default "/tab <tab_index>"?
Thank you in advance for your help!
To be clear, I want for each tab a completely different message.
For example, the first tab could have the '/whatever 1 2 3' , the second tab '/anothermessage somestringparameter' and so on..
You could use the tab parent's onValue script:
if (value === 0) {
send('/foo', 1, 2, 3)
} else if (value === 1) {
send('/bar', 4, 5, 'six')
} // etc
It won't change how you select the tab using an external osc message though (which can be achieved with a custom module).
Thank you for your reply.
However, I want to be able to change the order of the tabs and have OpenStageControl send out consistent messages based on the tab id.
instead of
if (value === 0) etc,
can I do something like?
if (children[value].id=== 'foo') {
send('/foo', 1, 2, 3)
} else if (children[value].id=== 'bar') {
send('/bar', 4, 5, 'six')
}
I think I found the solution!
let fooIndex = getIndex('foo')
let barIndex = getIndex('bar')
// etc
if (value === fooIndex ) {
send('/foo', 1, 2, 3)
} else if (value === barIndex ) {
send('/bar', 4, 5, 'six')
} // etc
Now I can change the order of my tabs and send out consistent custom messages.
Nicely done !
Alternatively, with a switch statement:
switch (value) {
case getIndex('foo'):
send('/foo')
break
case getIndex('bar'):
send('/bar')
break
}
that's more elegant, thanks!
Hi @fewbio,
Would you mind providing a json file session for the community ?
It would be very cool to end a solved topic with a json file session for people to test and get more and more easy with Open Stage Control.
If you had this need, i am pretty sure, somebody else will have the same one day, so please share yours solutions !
Cheers
I would love to, but as a new user I am not allowed to upload attachments. Any suggestions?
You should be able to upload files now.
There you go!
CustomMessagePerTab.json (4.2 KB)
thank you and nice idea
i got a silly question but how can i put a button into the first tab and then pressed it opens the third ?
hum... yes it works but if we change the tab order as it was your goal you will have to change the number 2
correct. If I find a good solution to this, I will post it.
yes ! it's logical
Here is an improved version of the session:
CustomMessagePerTab.json (8.2 KB)
Any tab can now be externally selected by receiving a simple OSC message like this:
/a_tab
/another_tab
/yet_another_tab
The trick was to add a hidden momentary button with the same id as the tab inside the tab and have a script onValue command that activate its tab