enableEvent

enableEvent(name:   String;
            enable: Boolean): Boolean;

The enableEvent method of the Window class enables you to control at run time whether JADE logic associated with an event for a specific form or control is executed. You could use this method in thin client mode, for example, to speed up the data entry process for a TextBox control by disabling the keyDown event. The enableEvent method returns the previous state of the event (that is, it returns true if the event was enabled or false if it was disabled).

Use the name parameter to specify the name of the event that is to be disabled. Set the enable parameter to false if you want to disable the event specified in the name parameter. All events are enabled by default; that is, the enable parameter is set to true.

An exception is raised if the event name specified in the name parameter is not valid. Although a check of the event name is performed, no check is made to ensure that the event belongs to the window of the receiver.

Enabling or disabling an event has no impact if there is no logic associated with that event.

Event methods can be enabled or disabled in both standard (fat) client mode and in thin client mode.

For a Control class, calling an event method results in a call on that method of the control (for example, the keyDown method of the TextBox class) and then a call on the specific instance of the form of that control method (for example, textbox1_KeyDown).

Disabling an event method results in neither method being called.

The method in the following example shows the use of the enableEvent method.

load();
begin
    tbDesc.enableEvent("keyDown", false);
    self.enableEvent("mouseMove", false);
end;

The Window class isEventEnabled method returns whether a specified event is currently enabled.