Android Switch Example

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Android Switch Example

Post by elanorb » Wed Sep 04, 2013 4:52 pm

Hi

I have put together a small template for an Android switch control. It uses a template group and a behavior so if you use it in any stacks you'll need to make sure the button containing the behavior script is part of your stack too. You can download the sample stack here.

You create a switch by cloning the template group, settings its behavior and then setting 3 properties of the new group, the leftOption, rightOption and selectedOption. You check the currently selected option by getting the selectedOption of the group.

The "create" button in the sample stack shows you how to set up the switch, the "get value" button shows how to retrieve the user's choice and puts it into a field.

The switch is resizable.

If you have any question please let me know.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

Locked

Return to “Summer School 2013”