The Clicked event has different arguments for different objects:
Object |
See |
---|---|
Menus |
|
ListView and Toolbar controls |
|
Tab controls |
|
TreeView controls |
|
Window and progress bar controls |
|
Other controls |
For information about the DataWindow control’s Clicked event, see the DataWindow Reference or the online Help.
Occurs when the user chooses an item on a menu.
Event ID |
Objects |
---|---|
None |
Menu |
None
None (do not use a RETURN statement)
If the user highlights the menu item without choosing it, its Selected event occurs.
If the user chooses a menu item that has a cascaded menu associated with it, the Clicked event occurs, and the cascaded menu is displayed.
This script is for the Clicked event of the New menu item for the frame window. The wf_newsheet function is a window function. The window w_genapp_frame is part of the application template you can generate when you create a new application:
/* Create a new sheet */
w_genapp_frame.wf_newsheet( )
Occurs when the user clicks within the ListView control, either on an item or in the blank space around items.
Event ID |
Objects |
---|---|
pbm_lvnclicked |
ListView |
Argument |
Description |
---|---|
index |
Integer by value (the index of the ListView item the user clicked). The value of index is -1 if the user clicks within the control but not on a specific item. |
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
The Clicked event occurs when the user presses the mouse button. The Clicked event can occur during a double-click, in addition to the DoubleClicked event.
In addition to the Clicked event, ItemChanging and ItemChanged events can occur when the user clicks on an item that does not already have focus. BeginLabelEdit can occur when the user clicks on a label of an item that has focus.
Using the ItemActivate event for ListView controls You can use the ItemActivate event (with the OneClickActivate property set to true) instead of the Clicked event for ListView controls.
This code changes the label of the item the user clicks to uppercase:
IF index = -1 THEN RETURN 0
This.GetItem(index, llvi_current)
llvi_current.Label = Upper(llvi_current.Label)
This.SetItem(index, llvi_current)
RETURN 0
Occurs when the user clicks on the tab portion of a Tab control.
Event ID |
Objects |
---|---|
pbm_tcnclicked |
Tab |
Argument |
Description |
---|---|
index |
Integer by value (the index of the tab page the user clicked) |
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
The Clicked event occurs when the mouse button is released.
When the user clicks in the display area of the Tab control, the tab page user object (not the Tab control) gets a Clicked event.
The Clicked event can occur during a double-click, in addition to the DoubleClicked event.
In addition to the Clicked event, the SelectionChanging and SelectionChanged events can occur when the user clicks on a tab page label. If the user presses an arrow key to change tab pages, the Key event occurs instead of Clicked before SelectionChanging and SelectionChanged.
This code makes the tab label bold for the fourth tab page only:
IF index = 4 THEN
This.BoldSelectedText = TRUE
ELSE
This.BoldSelectedText = FALSE
END IF
Occurs when the user clicks an item in a TreeView control.
Event ID |
Objects |
---|---|
pbm_tvnclicked |
TreeView |
Argument |
Description |
---|---|
handle |
Long by value (the handle of the TreeView item the user clicked) |
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
The Clicked event occurs when the user presses the mouse button.
The Clicked event can occur during a double-click, in addition to the DoubleClicked event.
In addition to the Clicked event, GetFocus occurs if the control does not already have focus.
This code in the Clicked event changes the label of the item the user clicked to uppercase:
TreeViewItem ltvi_current
This.GetItem(handle, ltvi_current)
ltvi_current.Label = Upper(ltvi_current.Label)
This.SetItem(handle, ltvi_current)
Occurs when the user clicks in an unoccupied area of the window or progress bar (any area with no visible, enabled object).
Event ID |
Objects |
---|---|
pbm_lbuttonclk |
Window |
pbm_lbuttondwn |
HProgressBar, VProgressBar |
Argument |
Description |
---|---|
flags |
UnsignedLong by value (the modifier keys and mouse buttons that are pressed). Values are:
In the Clicked event for windows, the left mouse button is being released, so 1 is not summed in the value of flags. For an explanation of flags, see Syntax 2 of MouseMove. |
xpos |
Integer by value (the distance of the pointer from the left edge of the window workspace or control in pixels). |
ypos |
Integer by value (the distance of the pointer from the top of the window’s workspace or control in pixels). |
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
The Clicked event occurs when the user presses the mouse button down in progress bars and when the user releases the mouse button in windows.
If the user clicks on a control or menu in a window, that object (rather than the window) gets a Clicked event. No Clicked event occurs when the user clicks the window’s title bar.
When the user clicks on a window, the window’s MouseDown and MouseUp events also occur.
When the user clicks on a visible disabled control or an invisible enabled control, the window gets a Clicked event.
If the user clicks in the upper left corner of the window, this code sets focus to the button cb_clear:
IF (xpos <= 600 AND ypos <= 600) THEN
cb_clear.SetFocus( )
END IF
Occurs when the user clicks on the control.
Event ID |
Objects |
---|---|
pbm_bnclicked |
CheckBox, CommandButton, Graph, OLE, Picture, PictureHyperLink, PictureButton, RadioButton, StaticText, StaticHyperLink |
pbm_lbuttondown |
DatePicker, MonthCalendar |
None
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
The Clicked event occurs when the user releases the mouse button.
If another control had focus, then a GetFocus and a Clicked event occur for the control the user clicks.
This code in an OLE control’s Clicked event activates the object in the control:
integer li_success
li_success = This.Activate(InPlace!)