Element: window.exec { }

Type

callback

Description

The command procedure to be executed when a mouse hit is made in the contents area of a window during menu polling. The window identifier is passed to the procedure as a parameter.

This element is available on graphic, display and tree windows only.

New windows have an exec procedure of null.

For Graphic and Display Windows:

If the window has a .down, .drag or .up procedure defined, this procedure must contain a pulldown menu otherwise it will never be invoked.

The callback is invoked when a particular mouse button is clicked in the window. By default this is the left mouse button (button 1) but may be redefined via the .exec_button element.

For Tree Windows:

This procedure must contain a pulldown menu. If so, it is invoked when the user clicks the right mouse button within the tree window, over a treenode or otherwise.

Within the callback, the tree window member .context_node may be used to determine the node currently under the mouse. This node may have a null value.

Parameters

window.exec (<window>)

Examples

The following procedure, when win1 is a graphic window, will display a pop-up window on a right mouse button click.

# Create a graphic window
win1 = wgraphic
 
# Use the right mouse button to invoke the callback
win1.exec_button = mouse_buttons
 
# Define the callback
win1.exec = {
   args w=window
   pulldown {
      1: 'Properties' { !Properties option picked }
      2: 'Delete' { wdelete w }
   }
}

As in the above case, the procedure may contain a pulldown menu. If so it is invoked when the user presses a mouse button while in the window. The button which invokes the pulldown menu is defined by the element window.exec_button. If this has not been set, then mouse button 1 invokes the pulldown.