In this recipe, you will learn how to use a MobGUI toggle button, which is also referred to as a switch. You will create a mood toggle to display how you are feeling.
Before using this recipe, you will need to have the MobGUI plugin downloaded and installed on your development computer. See the Setting up MobGUI recipe discussed earlier in this chapter.
Follow the steps in this recipe to create a toggle button and allow the user to select between mood values of Happy and Sad:
Create a new main stack in LiveCode.
From the Development menu, navigate to Plugins | revMobGUI.
Click on the play button, shown in the following screenshot, from the icons on the MobGUI interface:
-
Drag the
icon from the MobGUI interface to the card. This will result in a group being added to the card.
Using the property inspector, change the width to
128
.Using the property inspector, change the position of the group so that it is at location
160,58
.Click on the new toggle...