General

Switch off radio buttons?

Started by iPad_User on .

Sign in or create an account to join the conversation.

10 posts

Topic starter
Hey folks,

okay... this should be an easy thing... but I'm sitting in front of my computer like an idiot.

I have some switches in my layout which are in "radio-mode".
I added an expression:
selTab=show(Container, firstoff(x))
By pushing one of those buttons the container next to it changes his tab.

What I now want to achieve is, that the container hides completely if I press the radio-button again (and if the radio-buttons turns off would also be nice).

Anybody? :-)

Thanks!
Chris
it seems not so simple to me. Pressing the lit radio button again normally results in nothing. Maybe it is better to have a different button to make the container vanish?

If the primary idea with the radio buttons is important, there should be some methods possible. For example, when a button is lit, an invisible Canvas object is moved there, and if you hit that Canvas object, it sets the button array to 0 and vanishes back outside the interface. And hides the container.
Phil999 wrote:I would try with Switches.x=0. If that doesn't work try Switches.x=fill(0,0,n). n is the number of switches.
Thanks! I already tried that. It disables all buttons. But the container is still visible and doesn't disappear...
If you don't mind having an extra button it's as easy as adding a second expression to the switches.

Let's say you've got 3 tabs and 4 switches. You just add this expression to the switches for tab changing:
selTab=selecttab(Container,firstof(x)-1)
And this expression for hiding it with the first button:
showContainer=show(Container,firstof(x))
The container is only shown when the first button is pressed, because then show will have a value of less then 1 which means it's invisible. And the other three buttons show the tabs.
just change the expressions to:
selTab=selecttab(Container,firstof(x))
and:
showContainer=show(Container,3-firstof(x))
with 3 being the number of the last switch, so if you have 5 switches the 3 would become 4.

It now subtracts the firstof of the number of switches and only comes to zero when the firstof equals the number