Event-Handler Routines 

Dynamic Properties

 

Graphical user interface control objects have a variety of design attributes associated with them. The Apostrophe Operator (tick) allows dynamic access to the property names used to define these attributes for a given graphical user interface control. Any numeric variable containing the CTL number associated with a control can be used with the apostrophe operator. REFRESH_FLG, which forces the update of the panel controls, does not have to be set. This feature allows you to redesign a control object dynamically in your application by assigning or resetting its properties/attributes.

A button's location, size, text and colour would be represented by properties named Col, Line, Text$, TextColour$, etc.

Example:

You could change the text of a button control (called MyButton) as follows:

MyButton.ctl'Text $ = "Hit me now"

Other common property names include:

 

'Col

Starting column

 

'Line

Starting line

 

'Cols

Width of control

 

'Lines

Height of control

 

'Tip$

Tip message

 

'Msg$

Message line

 

'Fmt$

Format mask

 

'BackColor$

Background color

 

'Enabled

Enabled state

 

'Lock

Locked state

 

'Value$

Current value/state of control

To obtain a complete list of properties for a given control, read the logical attribute *:

PRINT BUTTON_1.CTL'*

This would result in a list of the attributes for the control BUTTON_1.

There is virtually no end to what can be changed on the fly within your controls. Most control commands can be changed by accessing attributes.

Warning!
NOMADS stores the current value of a control in a variable with the same name as the control. If you change a control value using the 'Value$ property, you must also change the control's variable to keep NOMADS in sync.

The examples below illustrate some of the uses of dynamic properties.

NOMADS object CUST_NAME is defined as a multi-line 30 wide x 1 high:

->PRINT CUST_NAME.CTL'*
Auto,BackColour,Col,Cols,CtlName,Enabled,Eom,Fmt,Focus,Font,Height,hWnd,
Key,Left,Len,Line,Lines,Lock,Msg,Nul,OnFocusCtl,Parent,Sep,TextColour,Tip,Top,Value,Visible,Width,
->LET CUST_NAME.CTL'Tip$="This is a NEW Customer Name Tip"

The following shows how you can dynamically change properties of an object:

IF COUNTRY$="CDN" THEN ZIP.CTL'Fmt$="A0A 0A0" ELSE ZIP.CTL'Fmt$="00000"