Events

Top  Previous  Next

Events occur when the user interacts with a dialog which you have created using the DIALOG CREATE command.  Some events occur by default, such as those generated by buttons.  Others only occur if you specify a style in a dialog element definition.

 

Because events can have the same name, no matter which dialog generated them, the @EVENT function has an extra parameter D to obtain the dialog ID: @EVENT(D). Programming with multiple dialogs is quite difficult so it is best to examine the simple examples that show how it is done.

 

You can halt your script and wait for an event to occur using the WAIT EVENT command.  You can find out the type of event using the @EVENT function.

 

BUTTON events occur when a button or a bitbtn is pressed.  The type of event is <name>BUTTON, where <name> is the name of the button.  So when the user presses a button labelled OK an OKBUTTON event occurs.

 

CLICK events are optional.  They cause a <name>CLICK event to occur when the dialog element is clicked with the mouse.  In the case of elements such as LIST or RADIO you can use the event to perform some action dependent on the new setting of the control. In the case of BITMAP dialog elements you can use the @CLICK function to find out which button was pressed and the position of the mouse at the time it was clicked..

 

DBLCLICK events are optional.  They cause a <name>DBLCLICK event to occur when the dialog element (a list) is double clicked with the mouse. 

 

DDEMACRO event occurs when the server receives a macro command (see DDE Application).

 

CLOSE events occur when the user closes the dialog from the system menu or using the close button, or when the user shuts down Windows.  The script should respond to this event by saving any unsaved data and terminating.

 

To receive DRAGDROP events DRAGDROP style must be used with the DIALOG CREATE command.  A DRAGDROP event occurs when a file or files are dragged to the dialog window.  You can find out the filenames by using the LIST DROPFILES command to get them into a string list.

 

EXIT events are optional.  They cause a <name>EXIT event to occur when the dialog element loses the input focus.  This event is available for EDIT and COMBO dialog elements.  It can be used to trigger a procedure to validate the data that has been entered in the control's input field.

 

An ICON event occurs when the user clicks on a task bar icon created when a TASKICON dialog element is used.

 

MENU events occur if you have defined a menu for the dialog window.  The type of event is <name>MENU where <name> is the name of the menu item that was selected. They also occur for a DIALOG POPUP command.

 

A TIMER event occurs when you use a command of the form WAIT EVENT, <interval>.  It occurs <interval> seconds after the command was issued.