Using Flags

Tutorials for working with our software
Locked
User avatar
DemoPad
Site Admin
Posts: 714
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Using Flags

Post by DemoPad » Thu Jul 05, 2012 4:27 pm

Flags are Boolean (YES/NO) variables within the software. They can have one of two values: ON, or OFF. Any action can set the status of a flag, and they are used for the following purposes:
  • 1. Flag Dependent Actions – where particular parts of an action list are only executed if a particular flag is set to, say, ‘ON’. (Conditional Logic Statements)
    2. Making objects / pages appear – you can have certain objects appear on screen in response to a flag being set to ‘ON’, and have them disappear when the flag is set to ‘OFF’
    3. Disabling buttons – you can disable a button by having all actions dependent on a flag
To create a flag, choose ‘Add’ from the ‘Project Flags’ option of the project menu. A flag simply has a name, which must be unique. You can organize flags in group folders. When the DemoControlHD app is first launched, all flags have a value of ‘OFF’. (Unless you have selected the ‘Remember Last Page’ option in the app settings, in which case all flags have the value they were last set to when the app was running)

A flag can be set by creating an action on a button push/release, page load, or app load event. Whilst in the action editor, select ‘Set a Flag’ as the action type, choose the flag from the drop down list & set the value (either ‘ON’ or ‘OFF’). You can also choose to set an entire flag group to ON or OFF.

It is often useful to use the “App Startup Actions” editor to set the default state of certain flags, so that they are set to “ON” when the app is launched.

Flag Dependent Actions
At the point at which actions are due to execute (ie after their delay, if any), the system can look at the state of a flag to determine whether to actually process the action. To set this up, simply choose a ‘Dependent Flag’ before adding the action, and choose the value that flag must be equal to in order for the action to occur.

Making objects appear
Merged pages, and page objects can have an optional ‘Reveal’ flag, which means that they only appear if a flag is set to ‘ON’. This can be useful for bringing up device remote controls etc.

Disabling buttons
Whilst dependent actions are only executed if the state of a flag matches the required state, the decision whether or not to execute the action is made at the time the action is supposed to execute.

It is also possible to completely disable all actions from occurring, based on a global button dependent flag. This is configured by expanding the ‘Actions’ menu for the button. If a dependent flag is selected, and the condition is not met at the point that the button is pressed / released, then no associated actions will occur – whether they themselves are dependent on a flag or not – effectively you are disabling the button, based on the condition of a flag.

Related Topics
Animating Your Project
Adding Buttons to your Project
Implementing Press & Hold

Tags
add edit change flags signs on off swap

Locked