2D Graphics > Creating Prototypes in Rogue Wave Views Studio > Defining an Interactive Behavior for a Prototype
 
Defining an Interactive Behavior for a Prototype
You are going to define an interactive behavior for your prototype. This is done by adding Event behaviors, defined in the Interactive Behavior page, the remaining page of the Group Inspector.
1. Choose myproto from the Window menu in the Main window to bring the Prototype buffer window to the foreground.
2. Click the Interactive Behavior tab in the Group Inspector panel.
3. Choose Events > Callback in the menu.
A new attribute named “Action” is created, as well as a Callback behavior and a “Watch” behavior.
4. In the matrix on the right side of the page, set the Graphic Object parameter to gauge. Leave the Callback Name and Input parameters on their default settings of Generic and 0 respectively.
The Callback accessor specifies that when the Generic callback of the gauge is called (through user input), the temperature value will be queried and sent to whatever object listens to the changes of the Action value. These “listeners” can be other accessors of the same prototype, other prototypes, or application objects. By default, adding the Callback behavior has added to itself a “Watch” behavior.
5. Choose Control > Assign from the menu bar.
A new assigned behavior is added at the bottom of the Action behavior.
6. In the matrix on the right side, select the parameter values as follow:
*Attribute: temperature
*Send: gauge > value
This means that when the callback is triggered through user action, the temperature attribute is adjusted to match the gauge value.
7. Choose Save from the File menu of the Main window to save the prototype.
You can test the interactive behavior of your prototype:
1. In the Prototype buffer window, select the Active mode, either by issuing a marking menu command (right, then left), or by choosing the Active icon in the Editing Modes toolbar.
2. Click within the gauge object, or drag the level up or down. You will see the gauge update itself, as well as change color when you cross the threshold value. In the Group Inspector Interface page, you will see the temperature update itself each time you end the interaction.

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