Language Reference Guide : 5. Events : Click Event
 
Share this page                  
Click Event
The Click event is triggered when the user clicks a field and the field has an interactive bias (FB_LANDABLE or FB_CHANGEABLE). For menu fields, the Click event is triggered when the user selects the menu item.
This event has the following syntax:
on click [fieldname]
fieldname is optional if you specify the event in a field script.
The following attributes of the FrameExec class can be used in the Click event block:
TriggerField
Specifies the field that the user clicked.
The value for this field must match the OriginatorField value.
OriginatorField
Specifies the field in the initial on click statement.
The value for this field must match the TriggerField value.
InputFocusField
Specifies the field that has the current input focus
PreviousField
Specifies the field that previously had the input focus.
This is useful if the clicked field has FocusBehavior set to FT_TABTO or FT_TAKEFOCUS, and thus would become the new InputFocusField.
Use the CurFrame system variable to access the FrameExec variables. For more information, see FrameExec Class.
Usage: The Click event is defined for the following classes:
BarField Class
ButtonField Class
ImageField Class
ImageTrim Class
ListField Class
MenuButton Class
MenuList Class
MenuToggle Class
OptionField Class
RadioField Class
ScrollBarField Class
SliderField Class
ToggleField Class
Click events are primarily used for detecting clicks on menu items or buttons. Examples of using the Click event are:
To make a Close menu item close a frame.
For example:
on click menu.file_menu.close_menu =
begin
return;
end
To detect any primary clicks made while the cursor is positioned over an enumerated field (RadioField, OptionField, ListField, or MenuList).
This behavior contrasts with the SetValue event for enumerated fields, which triggers an event only if the user changes the current value of the field.
When the user clicks a field, the action might trigger a SetValue and/or Exit event on the previous field, depending on the clicked field's FocusBehavior attribute setting. Any SetValue and Exit events triggered by the click are executed before the Click event. For more information about this, see the description of the FocusBehavior Attribute for the ActiveField class and the FocusBehavior Attribute for the MenuField class.
A field with a bias of FB_VISIBLE cannot receive Click events. However, if the user clicks such a field, the click passes through the visible field and is detected by any fields that are physically underneath the visible field and set to a bias of FB_LANDABLE or FB_CHANGEABLE. This feature lets you build hot spots on an image or other type of field by setting its bias to FB_VISIBLE by placing active button fields behind the areas in the image that you want to detect.
More information:
InputFocusField Attribute
OriginatorField Attribute
PreviousField Attribute
TriggerField Attribute