Page 1 of 1

Button On / off

Posted: Sat Feb 07, 2015 1:11 pm
by fko2
Hi,

First of all, i would like to say that i am the same user as 'fko'...so 'fko' and 'fko2' we are the same! :-)
After one period i didn't enter in this forum i didn't manage to do it ( i had one problem of memory with password or / and my email ).

Anyway, it is not grave! now i am here again, even if another nick name!!!

I have one question about how to make one button 'On/Off'!!! Maybe i am asking something very easy, so sorry for this...:-(
I want to do it in one 'mobile' device, and i would like to 'swipe' / 'drag' or ' i don't kow exactly what' to can go to the right and put it on, or go to the left on this button to put it off.
I don't know if it is understandable...But what i want, is to do the same as the putton to activate or desactivate the wifi in one iphone...
Maybe like this was easier to understand!

Thank you!

fko

Re: Button On / off

Posted: Mon Feb 09, 2015 2:53 pm
by JacobS
Hi fko2,

I assume you're looking for something like this:
Image
Which Apple calls a "switch" control.

Right now, LiveCode does not support creating a native switch control with the mobileControlCreate function. This means that you'll need to download MobGUI or a similar program to that lets you create a switch control. I know some people are having trouble with MobGUI together with LiveCode 7, but I think that's your best bet at the moment.

Hope that helps.
-Jacob

Re: Button On / off

Posted: Mon Feb 09, 2015 6:44 pm
by jmburnod
Hi fko,
Why not creating your own control ?
You can do it with Livecode.
Best regards
Jean-Marc

Re: Button On / off

Posted: Mon Feb 09, 2015 7:18 pm
by jmburnod
Hi Jacob,
In few minutes I've made a switch btn with the images that Jacob has posted.
Have a look at the stack in attachment
Best regards
Jean-Marc

Re: Button On / off

Posted: Mon Feb 09, 2015 7:32 pm
by JacobS
Jean-Marc,

Yes, that is a very good solution! I guess I didn't think of simply skinning a button and changing the image through code. This solution doesn't include the actual slide animation while dragging your mouse across it, but it's still a pretty good solution if you need a switch.

fko,
I'd look at Jean-Marc's stack: very easy, very quick, easy to customize.

-Jacob

Re: Button On / off

Posted: Mon Feb 09, 2015 7:37 pm
by jmburnod
Hi Jacob
This solution doesn't include the actual slide animation while dragging your mouse across it
Yes. In this case our brain does the job 8)
If we want an animation we have to use one group
Jean-Marc

Re: Button On / off

Posted: Tue Feb 10, 2015 6:08 pm
by fko2
Hi,

Thanks for the example and your answers!!!

Yes, it seems very easy now...Even if i don't imagine i would be able to do it myself!!! :-)

What does it mean that for the animation we have to use one group? It means that we can make his switch as we are making one real drag????

Regards
fko

Re: Button On / off

Posted: Wed Feb 11, 2015 9:10 am
by jmburnod
Hi fko,
It means that we can make his switch as we are making one real drag????
Yes we can
Here is a simple group example.
Best regards
Jean-Marc

Re: Button On / off

Posted: Wed Feb 11, 2015 10:59 am
by fko2
Hi Jean-Marc,

Thanks a lot for this switch button...:-)

Regards.
fko

Re: Button On / off

Posted: Wed Feb 11, 2015 11:25 am
by jmburnod
Hi fKo,
This time it is not a btn but a group. Each part of this group is a livecode control.
We can make a look better with gradient and graphic effects
Best regards
Jean-Marc

Re: Button On / off

Posted: Wed Feb 11, 2015 2:10 pm
by fko2
Hi Jean-Marc,

Ok, so i will see if i can manage with the gradient and graphic effect...

Thanks for your help! :-)

Regards.
fko