Gadgets > Rogue Wave Views Application Framework > Editing States > Editing the Show State > Changing the Label and the Callback of the Show Button
 
Changing the Label and the Callback of the Show Button
The states mechanism provides you with predefined callbacks that let you set or leave a state. A callback is a state requirement attached to an object in a particular state. It can be overridden in different states.
In the next exercise, you want the Show button to bring the application from the Show state back to the Root state. You also want to change the button label so it displays Root when the Show state is selected.
1. Select the Show state in the State Tree panel.
2. If necessary, click the New requirements icon at the top-left of the State inspector to add a new row.
3. In the State inspector, click in the empty row of the Panel column.
A combo box appears with a list of the panel instances from the application.
4. Select Panel1 from the list.
5. In the Object column, select ShowButton from the list of objects in the combo box.
6. Click in the Attribute column and choose label from the list.
Scroll down the list to make label appear.
7. Type Root in the Value field and press Enter.
A new row is automatically added when you reach the last column and press Enter.
8. Click in the Attribute column of the new empty row.
The panel and object names are automatically copied from the previous line and the related state requirement names are displayed.
9. Choose callback.
10. Click in the Value column and choose leaveState(Show).
When you test your application and go into the Show state (by clicking the Show button), the label of the Show button changes to Root. When you click it once again, you are back to the initial Root state. The label and callback of the Show button are restored and Panel2 is hidden. In short, when you leave a state, the properties modified by the state requirements are restored.

Version 6.2.1
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.