Clicked event
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.
Syntax 1 For menus
Description
Occurs when the user chooses an item on a menu.
Event ID
Event ID |
Objects |
---|---|
None |
Menu |
Parameters
None
Return Values
None (do not use a RETURN statement)
Usage
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.
Examples
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:
1 |
/* Create a new sheet */ |
1 |
w_genapp_frame.wf_newsheet( ) |
See Also
Syntax 2 For ListView controls
Description
Occurs when the user clicks within the ListView control, either
on an item or in the blank space around items.
Event ID
Event ID |
Objects |
---|---|
pbm_lvnclicked |
ListView |
Parameters
Argument |
Description |
---|---|
index |
Integer by value |
Return Values
Long. Return code choices (specify in
a RETURN statement):
-
0 Continue
processing
Usage
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.

You can use the ItemActivate event (with the OneClickActivate
property set to true) instead of the Clicked
event for ListView controls.
Examples
This code changes the label of the item the user
clicks to uppercase:
1 |
IF index = -1 THEN RETURN 0 |
1 |
1 |
This.GetItem(index, llvi_current) |
1 |
llvi_current.Label = Upper(llvi_current.Label) |
1 |
This.SetItem(index, llvi_current) |
1 |
RETURN 0 |
See Also
Syntax 3 For Tab controls
Description
Occurs when the user clicks on the tab portion of a Tab control.
Event ID
Event ID |
Objects |
---|---|
pbm_tcnclicked |
Tab |
Parameters
Argument |
Description |
---|---|
index |
Integer by value (the index of the tab |
Return Values
Long. Return code choices (specify in
a RETURN statement):
-
0 Continue
processing
Usage
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.
Examples
This code makes the tab label bold for the fourth
tab page only:
1 |
IF index = 4 THEN |
1 |
   This.BoldSelectedText = TRUE |
1 |
ELSE |
1 |
   This.BoldSelectedText = FALSE |
1 |
END IF |
See Also
Syntax 4 For TreeView controls
Description
Occurs when the user clicks an item in a TreeView control.
Event ID
Event ID |
Objects |
---|---|
pbm_tvnclicked |
TreeView |
Parameters
Argument |
Description |
---|---|
handle |
Long by value (the |
Return Values
Long. Return code choices (specify in
a RETURN statement):
-
0 Continue
processing
Usage
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.
Examples
This code in the Clicked event changes the label
of the item the user clicked to uppercase:
1 |
TreeViewItem ltvi_current |
1 |
1 |
This.GetItem(handle, ltvi_current) |
1 |
ltvi_current.Label = Upper(ltvi_current.Label) |
1 |
This.SetItem(handle, ltvi_current) |
See Also
Syntax 5 For windows and progress bars
Description
Occurs when the user clicks in an unoccupied area of the window
or progress bar (any area with no visible, enabled object).
Event ID
Event ID |
Objects |
---|---|
pbm_lbuttonclk |
Window |
pbm_lbuttondwn |
HProgressBar, VProgressBar |
Parameters
Argument |
Description |
---|---|
flags |
UnsignedLong by Values are:
In the Clicked event for windows, the left mouse button is being For an explanation of flags, |
xpos |
Integer by value |
ypos |
Integer by value |
Return Values
Long. Return code choices (specify in
a RETURN statement):
-
0 Continue
processing
Usage
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.
Examples
If the user clicks in the upper left corner of the
window, this code sets focus to the button cb_clear:
1 |
IF (xpos <= 600 AND ypos <= 600) THEN |
1 |
   cb_clear.SetFocus( ) |
1 |
END IF |
See Also
Syntax 6 For other controls
Description
Occurs when the user clicks on the control.
Event ID
Event ID |
Objects |
---|---|
pbm_bnclicked |
CheckBox, CommandButton, Graph, OLE, |
pbm_lbuttondown |
DatePicker, MonthCalendar |
Parameters
None
Return Values
Long. Return code choices (specify in
a RETURN statement):
-
0 Continue
processing
Usage
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.
Examples
This code in an OLE control’s Clicked event
activates the object in the control:
1 |
integer li_success |
1 |
li_success = This.Activate(InPlace!) |