Single switches and container tabs

Discuss Lemur and share techniques.
Post Reply
Rtech
Newbie
Posts: 26
Joined: 21 Dec 2012 20:30

Single switches and container tabs

Post 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.
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Single switches and container tabs

Post 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!

;)
Post Reply