HTBasic Help
×
Menu
Index

ASSIGN

Creates/destroys widgets
 

Example

                             
ASSIGN @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
 

Syntax

 
ASSIGN @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}(*) }  [, ...]
 
 
Item
 Description
 Range *depends on
atr_ary
single-valued array attributes: accompanying
num_ary or str_ary must have identical dimensions
*widget
num_ary
numeric array of attribute values
*attribute(s)
num_exp
numeric expression attribute value
*attribute
sstr_exp
single-valued string expression attribute
*widget
str_ary
string array of attribute values
*attribute(s)
str_exp
string expression containing attribute value
*attribute
mstr_exp
multi-valued string expression of attribute values
*widget
w_hndl
widget handle name (string expression)
any valid name
w_type
widget type string expression
 

Description

ASSIGN 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.
 
Widget
Description
Displays a numeric value with a rectangular bar
Displays a bank of numeric values
Displays and creates pixmap files
Menu within  PULLDOWN MENU or CASCADE MENU
Graphically displays time
Combination of string and list widgets
Allows selection of disk volume, directory, or file
Displays HPGL graphics files
Method to enter numbers without using a keyboard
Displays text or can be placed as label of another widget
Graphically displays numeric values
Scrollable list of textual items
Appears in PULLDOWN MENU or CASCADE MENU
Line between items in PULLDOWN or CASCADE MENU
Menu button that toggles between states
Displays numeric values with a needle
Can enter and format numbers with specified limits
Used as a "container" or "parent" widget
Used to display blocks of test
Provides a menu of selections
Button that can be placed on the screen or in a PANEL
Bank of buttons - only one button at a time can be set
Used to input a relative position
Line used to visually separate areas of a PANEL
Slider pad that moves from minimum to maximum value
Can enter or display  string or array of strings of text
Displays data in a two-dimensional scrolling graph
Displays and modifies screens built with ScreenBuilder
Used to input or display binary data
Used to plot data on an X-Y coordinate plane
 
 

PARENT Option

If 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 Option

The 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 Option

All 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 Attributes

You 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(*))