Page 1 of 1

Single switches and container tabs

Posted: 28 Mar 2013 23:03
by Rtech
I just got container tabs switching working good with multiple pads and multiple switches. I can't however figure out how to switch tabs in a 2-tabbed container through a single switch or single pad. How do I do this?

Also, is there a way to set the initial value in either a single switch or array of switches? Default, all switches in the switch object will be set to off. I would like the first switch to be set to on when the template is first opened.

Re: Single switches and container tabs

Posted: 29 Mar 2013 00:09
by Softcore
Lets say our two tabbed-container is named "Container"...

Add a switch and add a script in that switch on expression x, any

type in the script

Code: Select all

selecttab(Container, x);
If you specifically want to make it happen with a pad, you could I guess do that too by adding a custom expression and making sure it toggles on each press...let's say you create the custom expression "t" and leave it blank..... then you would add

a script on expression x, rising form zero (up arrow)

Code: Select all

if (!t) t=1; 
else t=0;
selecttab(Container,t);
or

Code: Select all

t += 1;
if (t>1) t=0;
selecttab(Container,t);

____________________________________

To initialize ANY object with a desired value just add a script in the root of your project, name it "init" or smthing and instead of using the "on expression" choice select "on load"....This means the script will be executed when the template is first opened....

Inside that script set the value for the desired object...for example in the case of a switch set to on you would type:

Switch.x=1;

Although I think it might be sufficient if you just saved the template with the switch on - though Im not sure - the above example though, with the script on load will surely do what you want regardless of the state of the object when the template is saved.

enjoy!

;)