In this application there are three input buttons and a text label. We want the text label to change to reflect the name of the input button selected.
There are two ways to accomplish this task. One uses multiple pages and the other uses variables. Since both ways are good for certain applications it is good to be aware of both methods to choose which method best fits your application.
Attached to this article is the .irl file used to create the demo. Feel free to upload it into your account and see how it works.
- Method 1: Multiple Pages
In the panel named ‘Without Variables’ there are four pages: Default, Apple TV, Computer and Blu-ray.
Each button contains a link to send the GUI to the specific page for the input selected.
None of the buttons need a selected image state and therefore do not need a deselect group tag.
Each page has specific button images that reflect the currently selected input and its own text label that specifies which input is currently selected.
This configuration works fine to accomplish the specified task.
- Method 2: Using Variables
In the panel named ‘With Variables’ you find one page.
The ‘Name’ field of the text label has a variable name called $label$.
A set variable action on each of the three buttons changes the value of the $label$ variable to the name of that specific input.
The selected button image states and deselect group tags take care of the button selection.
This single page accomplishes the same task as the four pages used in Method 1.
We therefore have two very different methods of accomplishing the same task. This solution demonstrates the power of using variables in an application when it makes sense.
See the attached K-Touch backup file to see the project in action.