disableEvents

Type: Boolean

Availability: Read or write at any time

The disableEvents property of the Window class specifies whether all events associated with a form or control are currently disabled (ignored).

User logic associated with an event is not executed when the events are disabled.

The settings of the disableEvents property are listed in the following table.

Value Description
false All events are enabled (the default)
true Disables (ignores) the events

Setting the disableEvents property to true for a form disables all events for the form and any of its controls. If a form has the disableEvents property set to true, requests to unload the form using a click on the close menu, a button, or the Alt+F4 keystrokes will be rejected.

In addition, if the form is an MDI child, the user request of the unloading of the MDI frame using these same mechanisms will also be rejected. If the value of the disableEvents property remains true and the unloadForm method of the Form class is called, the queryUnload and unload events are not called. (This handling of the disableEvents property is intentional.)

Use this property when events are to be ignored during some operation; for example, when performing a process that takes some time and where the user may get impatient and attempt to click the Go button again. Its advantage over using the enabled property is that it does not change the appearance of the form or the controls.