MSM-Workstation
Macros

Go back to the alphabetic list of macros
Go back to the first page of this tutorial

%%Set ( ObjectProperty , [ Argument ] )

Set the value of the property of a window or control.

ObjectProperty An object and property specification. Window and Control default to the current window and control. The property name, if omitted, defaults depending on the object type. It is usually "Value", but in the case of Labels and Windows the default is Title. See Default Properties.

Argument If Property is not multiple-valued, an expression yielding the value to assign to the property. Otherwise, a local or global variable name (may be subscripted), which has the values as immediate descendants. Default is the variable with its name corresponding to the first 8 characters of the property name.

The macro %%Set sets the value of the property of the indicated object using the Argument.

Note that when manipulating the value of certain properties using the Property Bar, symbolic names such as "Yes" and "No" are used. However when manipulating the value using macros, the underlying values must be used. These are given in parentheses at the end of the symbolic name; in the case of "Yes" and "No" these values are 1 and 0 respectively.

Examples

%%Set(Order..Color,%%Red)
Set the color of the window called "Order" to red from any action logic.

%%Set(ForeColor,%%Green)
Set green foreground color for current object (window or control)

%%Set(..Title,"Hello, World")
Set current window title to the string constant "Hello, World" from any action logic.

%%Set(TestNo.,^RSLT(PID,1))
Set the value of the (non-list) control called "TestNo" in the current window from the global reference ^RSLT(PID,1), where local variable PID must have a non-empty value.

%%Set(@Ctl.Visible,$P($H,",",2)<43200)
Hide the control named in local variable Ctl if time is not before midday, else make it visible.

%%Set(,Order("Food"))
Assuming current control is a list, set all the values of subscript x in Order("Food",x) as selected choices of the list.

See also

%%Get, %%GetChoice, %%GetSel, %%Prop, %%Reset, %%ResetChoice, %%ResetSel/a>, %%SetChoice and %%SetSel.