2D Graphics > Creating Prototypes in Rogue Wave Views Studio > Defining the Graphic Behavior of the Prototype
 
Defining the Graphic Behavior of the Prototype
Once you have defined the interface and the graphic objects that make up your prototypes, you can start linking them together by adding behaviors. These determine how a graphic object will change when an attribute of the prototype changes.
1. Move to the Graphic Behavior tab of the Group Inspector.
2. Select the temperature attribute in the attributes tree.
3. Select Control > Assign.
A new behavior is added. You now have to specify the parameters of this behavior.
4. Click twice in the right hand column of the Attribute parameter of the new assigned behavior to open the combo box.
5. Select the item gauge > value, or type gauge.value in the text field and press Enter.
6. Click twice in the right hand column of the Send parameter of the assigned behavior to open the combo box.
7. Choose [All Types] to display all the parameters and select the item temperature, or type temperature and press Enter.
This assigned behavior specifies that when the temperature is to be changed, it will set the value attribute of the gauge to the current value of the temperature.
You are going to add a second action to the temperature accessor. This action will specify that when the temperature rises above the threshold value, the gauge will appear red and when the temperature is below the threshold value, the gauge will appear blue.
1. If not still selected, select the temperature attribute.
2. Select Control > Condition. This adds a new behavior below the previous assigned behavior.
3. There are 5 parameters to set for this behavior. Using the same techniques as before, clicking twice in the right hand column and selecting from the resultant combo box, set the following values for each parameter:
*Operator: >
*Operand: [All Types] > threshold
*Attribute: gauge > foreground
*if True: [Immediate value], then type red in the text field. (You can also select the item Choose... in the combo box and choose a color using the color selector.)
*if False: [Immediate value], then type blue in the field to enter the color.
Changing the value of temperature is associated with two actions. First, the actual level of the gauge changes. Second, the condition is tested and the color of the gauge is set accordingly.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.