Page 1 of 1

Switch off radio buttons?

Posted: 14 May 2015 13:14
by iPad_User
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:

Code: Select all

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

Re: Switch off radio buttons?

Posted: 14 May 2015 19:23
by Phil999
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.

Re: Switch off radio buttons?

Posted: 14 May 2015 19:29
by iPad_User
Hey!

Thanks for your answer.
It's not necessary, that the lit radio-button is pressed again. I'm cool with a separate "reset"-button.

Do you have any ideas regarding the code?

Thanks,
Chris

Re: Switch off radio buttons?

Posted: 14 May 2015 19:36
by Phil999
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.

Re: Switch off radio buttons?

Posted: 14 May 2015 20:41
by iPad_User
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...

Re: Switch off radio buttons?

Posted: 14 May 2015 21:18
by MrCorba
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:

Code: Select all

selTab=selecttab(Container,firstof(x)-1)
And this expression for hiding it with the first button:

Code: Select all

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.

Re: Switch off radio buttons?

Posted: 14 May 2015 21:53
by iPad_User
Yeyyyyy....

great! That's working!
In my case it would be nicer to have the last one enabling / disabling the container...

Hmmmm..... :-)

Re: Switch off radio buttons?

Posted: 14 May 2015 22:19
by MrCorba
just change the expressions to:

Code: Select all

selTab=selecttab(Container,firstof(x))
and:

Code: Select all

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

Re: Switch off radio buttons?

Posted: 14 May 2015 23:00
by iPad_User
Awesome! Perfect :-)

Thanks !!

Re: Switch off radio buttons?

Posted: 15 May 2015 14:12
by Softcore
There is a way to pull this off, using Pads as pseudo-switches - no need for the extra button this way. ;)