Control Object Agents

 

The Requester control identifier value, returned by functions like ctlstring() and ctlnumber(), enables the Control data type to sport its own set of object attributes.

Data Members

value
The value data member holds the context value displayed by the control. Reading from and writing to this value is equivalent to using the setvalue() and getvalue() functions, respectively, on the control identifier.The setvalue() function now first attempts to match a list value for ctlpopup() controls if a string value is provided. 

active (read-only)
active returns a Boolean value indicating the current active state of the control, where a 'true' value indicates that the control is currently active and can interact with the user.

label (>9.2 only)
The Requester Control Object Agent has a new data member, label. By reading and writing this value, you can alter the label text of a control that displays a label.

visible (read-only)
visible returns a Boolean value indicating the current visible state of the control, where a 'true' value indicates that the control is currently visible on the Requester panel.

x (read-only)
x contains the control's current X position on the Requester panel.

y (read-only)
y contains the control's current Y position on the Requester panel.

w (read-only)
w contains the control's width.

h (read-only)
h contains the control's height.

Methods

size(width,height)
This will allow you to change the width and height attributes of a control. For best results, you should first hide the control before you change these attributes, and then make it visible once again.

active([Boolean])
The active([Boolean]) method sets the immediate active state of the control. An optional Boolean value indicates whether or not the control should be active. If omitted, an implicit 'true' value is assumed.

visible([Boolean])
The visible([Boolean]) method sets the immediate visible state of the control. An optional Boolean value indicates whether or not the control should be visible. If omitted, an implicit 'true' value is assumed.

position(column, row)
position(column, row) sets the location of the control on the open Requester panel to the specified column/row. The repositioning action is immediate. You should use the visible() method before and after this call to ensure a clean move of the control.

Example:
This example script demonstrates how to use Control Object Agents by simply creating an interface and retrieving some of its attributes.

generic
{
    // perform all processing here
    reqbegin("<Requester Title>");
         c0 = ctlinteger("Integer Control",1);
         c1 = ctlnumber("Number Control",1.0);
         c2 = ctlstring("String Control","my string");
         c3 = ctlcheckbox("Checkbox Control",true);
         c4 = ctlpopup("Popup control",1,@"Item 1","Item

2","Item 3"@);
         return if !reqpost();

          info(c0.value);
         info(c1.x);
         info(c2.y);
         info(c3.w);
         info(c4.h);
    reqend();
}