Progress
Language Tutorial
for Character
Accessing Widget Attributes and Methods
Usually, the default attribute values assigned implicitly by Progress statements provide the appearance and functionality you want in your widgets. However, Progress also supports a syntax that lets you access attribute information directly. This syntax is shown below.
To display an attribute’s value, all you have to do is reference it in a DISPLAY statement, as shown below:
You can also assign widget attribute values to variables, as long as the variable is of the same data type, using the following syntax.
To set an attribute, you assign the new value to the attribute, but you must also specify the frame in which the widget resides. You use the IN FRAME phrase to identify the containing frame. Here is the syntax.
Follow these steps for a demonstration of widget attributes:
- Open
lt-03-10.p
.- Choose Compile
Run. You see a fill-in field with the label “Is Rectangle Visible?” and the value no.
- Choose the Show Rectangle button. A rectangle becomes visible and the value of the fill-in field becomes yes, as shown below:
![]()
- Choose Exit to end the procedure.
- Press SPACEBAR to return to the Procedure Editor.
This is the code that created the display:
These notes help explain the code:
- When you first create a widget, the VISIBLE attribute is set to YES by default. However, a field-level widget is not visible until its frame is visible. Therefore, when a frame becomes visible, all the widgets in it are visible by default. In this statement, you set the VISIBLE attribute to NO. When the frame displays, you won’t see the rectangle.
- You assign the value of the rectangle’s VISIBLE attribute to Field1.
- When the user chooses the button, the trigger changes the value of the VISIBLE attribute to YES, making the widget visible, since its frame is currently visible.
- You assign the new value of the VISIBLE attribute to Field1.
- The DISPLAY statement outputs the new value of Field1 to the screen.
This example also illustrates an important rule about accessing attributes for field-level widgets: You cannot access a widget’s attributes until that widget is referenced in a frame.
Methods
A method is a specialized function that modifies how a widget works. For example, the READ-FILE method allows you to read an operating system file into an editor widget. Methods are relatives of attributes and you access them in the same way you access attributes.
To use a method, follow these basic steps:
Here’s an example:
The later chapters of the tutorial discuss some of the most useful methods.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |