Enabled
Enabled(iSet)
Enables/disables controls in the group
iSet | Integer | Whether to enable or disable controls in the group |
---|
Applies to: Group
Enabled
Enables and disables a control
This is a style property that is only available in the forms designer. It is possible to modify this programmatically through the Style property in the Create event.
Applies to: Generic
Enabled
Enables/disables menu items
Boolean property
Applies to: MenuItem , TabbedItem
The Enabled boolean property can be used to disable a control or menu option programmatically preventing it from receiving focus and generating events. Disabled controls are generally greyed out to make their status clear. Setting a value of TRUE means the control is enabled while a value of FALSE means it is disabled. In general a control will be enabled by default though controls can be disabled in the Forms Designer.
The Enabled property is implemented as a style but, unlike most other styles which can only be set at design time, this style can be inspected and changed at run time.
Use with groups
The Enabled() group method can enable and disable all the controls in a group together. Specifying a value of TRUE enables the controls while a value of FALSE disables the controls. Groups are set up and named at design time within the Form Designer. For example the following would disable all the controls in the group grpControl1:
.grpControl1.Enabled(FALSE)
Use with tabs
The property can used to disable the specified tab page within a tab control. Tabs are initially enabled unless disabled by the tab editor in the Forms Designer. A disabled tab cannot become the visible page and is shown with its tab ear text greyed out. If the target tab page is the currently visible page then it will be moved to the back and replaced by the next tab in order. For example:
.TabControl1.tab1.Enabled = FALSE
To grey out all the tabs together, thus stopping the user navigating the control, use the Enabled property of the control itself e.g.
.TabControl1.Enabled = FALSE
Note that this will not disable the controls on the visible page.
If Enabled is set FALSE for a tab control then it disables only navigation within the tab control. All the tab ears are greyed out and the user cannot switch to another tab page. The controls on the current visible tab page are not disabled.
Use with menu items
If this property is set to the default setting of TRUE for a menu option, then the option will appear normally in the menu. However if set FALSE, either at design time or runtime, then the menu item will appear greyed out and will not generate any select events. For example to disable the File menu's Save option:
.FileMenu.SaveOpt.Enabled = ('DocModified() ? TRUE : FALSE)
To remove the option from the menu completely, rather than just greying it out, use the Visible property.