ExampleASSIGN @Panel TO WIDGET "PANEL";SET ("X":5, "Y":5,"WIDTH":500,"HEIGHT":350,"TITLE": "Engine Monitor")
ASSIGN @Strip TO WIDGET "STRIPCHART";PARENT @Main1,SET ("X":5,"Y":5,"WIDTH":350, "HEIGHT":250,"SHOW NUMBERING":0)
ASSIGN @Strip TO * ! Destroy the @Strip widget
SyntaxASSIGN @w_hndl TO { WIDGET w_type; { { PARENT @w_hndl | TRANSIENT | SET (set_atr_list) } [, ...] } | * }
where: set_atr_list = { sstr_exp: { num_exp | str_exp } | mstr_exp:{num_ary | str_ary} | atr_ary(*):{num_ary | str_ary}(*) } [, ...]
DescriptionASSIGN is used to:
ASSIGN associates a "widget handle" (equivalent to an I/O path) with a new widget to be used with commands like STATUS, CONTROL, and ON EVENT to control the appearance and behavior of the widget.
Widgets are destroyed by assigning them to nothing: ASSIGN @widget handle TO *
This table shows widget types that can be created with ASSIGN.
PARENT OptionIf no parent is specified when creating a new widget, the widget is said to be a "level-0" widget. A level-0 widget is not constrained to be within another widget, and may exist at any place in the HTBasic output window. The X and Y coordinates of the widget are relative to the upper-left corner of the HTBasic output window.
Only level-0 widgets may include a title bar, a resize border, and a system menu. The title bar and resize border allow you to change the position and size of the widget.
If a parent is specified, the new widget will be treated as a "child" widget of its parent. If you attempt to move a child widget outside the border of the parent widget, the child will be "clipped" at the parent widget's borders. The child widget's X and Y coordinates are relative to the upper-left corner of the parent widget.
Not all widgets can be parents and not all widgets can be children of parent widgets.
TRANSIENT OptionThe TRANSIENT option is used primarily when the resulting widget is to function as a dialog. If you create a widget using the TRANSIENT option, other non-transient widgets cannot be placed on top of the widget.
If the transient widget has a parent, the transient widget is not restricted to lie within the bounds of its parent as are other child widgets. Visually the transient widget appears to be a special type of level-0 widget.
SET OptionAll widgets have a variety of attributes that control their appearance and behavior. You can initialize the values of these attributes at the time of creation of the widget by using the SET option. Attributes are either scalar (may contain a single value) or vector (may be assigned an array of values) and have value of either numeric or string type.
Shorthand: Assigning AttributesYou can use a shorthand method to assign values to several scalar attributes without naming them individually on the ASSIGN statement. To do this, you store all the attributes in a string array and all the matching values in another array of the same size. Then, you specify both array names in the SET option of the ASSIGN statement. Elements of the string array that contain nothing are ignored. For example:
Attribs$(1) = "X"
Attribs$(2) = "Y"
Attribs$(3) = "WIDTH"
Attribs$(4) = "HEIGHT"
Values(1) = 5
Values(2) = 5
Values(3) = 500
Values(4) = 300
ASSIGN @Panel TO WIDGET "PANEL";SET (Attrib$(*):Values(*))
|