Changing the State of Menufields
- Last UpdatedNov 12, 2025
- 2 minute read
There are two methods you can use to set and read the status of menu- and menu-field properties.
Setting Menu-Options’ Status
You can de-activate a menufield on a menu bar and a field in a menu with the SetFieldProperty() so that it cannot be selected. Similarly, you can make them invisible so the user cannot see them.
You can also use SetFieldProperty() to hide a menu field and to select or unselect toggle-type fields.
The general syntax is:
!menu.SetFieldProperty (<FieldName>, <PropertyName>, Boolean)
Where the fields have the following meanings:
|
Field |
Description |
|---|---|
|
<FieldName> |
The name of the field you want to change. |
|
<PropertyName> |
The name of the property you want to change in the named field. The allowed values are: ‘ACTIVE’ - greyed in or out ‘VISIBLE’ ‑ visible or invisible ‘SELECTED’ - selected or unselected (toggle type fields, only. Specifically, this value cannot be used with bars). |
|
Boolean |
The value, TRUE or FALSE, for the property. |
Note: The property names may optionally be truncated to the first three characters ‘ACT’, ‘VIS’, and ‘SEL’.
For example:
!bar = !!MyForm.bar
!menu = !!MyForm.Menu1
sets local variables !bar and !menu to be references to the bar gadget and Menu1 of form !!MyForm.
Then
!bar.SetFieldProperty( 'Foo', ‘ACTive’, false)
will grey-out the menufield on bar that has the field-name "Foo". And
!menu.SetFieldProperty ( 'Bar', ‘ACTive’, true)
will activate the menufield on Menu1 that has the field-name "Bar".
You can use the same method to change the selected status of a toggle menu field.
Reading the Status of Menus and Menus’ Fields
To read the status of a menu or of a menu-field property, you can use the FieldProperty() method.
The general syntax is:
Boolean = !menu.FieldProperty (<FieldName>, <PropertyName>)
Where the fields have the following meanings:
|
Field |
Description |
|---|---|
|
<FieldName> |
is the name of the field you want to change. |
|
<PropertyName> |
is the name of the property you want to change in the named field. The allowed values are: ‘ACTIVE’ - greyed in or out VISIBLE’ ‑ visible or invisible ‘SELECTED’ - selected or unselected (toggle type fields, only. Specifically, this value cannot be used with bars) |
Note: The property names may optionally be truncated to the first three characters ‘ACT’, ‘VIS’, and ‘SEL’.
For example:
!bar = !!MyForm.bar
sets local variable !bar to be a reference to the bar gadget of form !!MyForm.
Then
!isSet = !bar.FieldProperty( 'Foo', ‘ACT’)
will get the greyed-out status of the menufield on bar that has the field-name "Foo".
You can use the same method to change the selected status of a toggle menu field.