Creating/Modifying Widgets
|
Overview
This topic gives guidelines to create and modify widgets using the ASSIGN command,
including:
·
|
Creating Widgets With ASSIGN
|
·
|
Creating a Default Widget
|
·
|
Preventing a Widget From Disappearing
|
NOTE
You can also create widgets and set widget attributes using the
ScreenBuilder Application.
Creating Widgets With ASSIGN
Widgets are created and destroyed with the
ASSIGN command. The ASSIGN command operates without suspending program execution. Therefore, widgets can display information on the screen as the program continues to execute. See the
ASSIGN command for the syntax diagram and command parameters.
Creating a Default Widget
To create a widget with default attributes, use the ASSIGN command without setting any SET set attribute list parameters. For example:
ASSIGN @Meter TO WIDGET "METER"
creates a
METER widget with default attributes, as shown in the following figure. to display this widget, enter the EDIT mode, type the following lines, and press RUN.
10 ASSIGN @Meter TO WIDGET "METER"
20 END
Preventing a Widget From Disappearing
When you ran the preceding program, you noted that the METER widget appeared, but then almost immediately disappeared. This is different from the way dialogs react. A dialog will wait indefinitely (unless given a TIMEOUT) for the user to respond.
In contrast, a widget appears and then almost immediately disappears when the program terminates. To keep the widget on the screen to view it, we must prevent the program from ending. For this example, we will insert an empty loop between lines 10 and 20. After a REN command, the program then looks like this:
10 ASSIGN @Meter TO WIDGET "METER"
20 LOOP
30 END LOOP
40 END
When this program is RUN, the widget will now remain on the screen for viewing. To stop this program from running, remove the
focus from the widget and then press the Stop or Pause key or type stop at the command line.