Clicked
event (DataWindows)
Description
Occurs when the user clicks anywhere in a DataWindow control.
PowerBuilder event
information
Event ID: pbm_dwnlbuttonclk
Argument |
Description |
---|---|
xpos |
Integer by value. The distance of the pointer from |
ypos |
Integer by value. The distance of the pointer from |
row |
Long by value. The number of the row the user If the user does not click on a row, the |
dwo |
DWObject by value. A reference to the control within |
Return Values
Set the return code to affect the outcome of the event:
0 — Continue processing
1 — Prevent the focus from changing
For information on setting the return code in a particular
environment, see About return
values for DataWindow events.
Usage
The DataWindow Clicked event occurs when the mouse button is pressed
down.
The dwo, Name, or object argument provides easy access to the
control the user clicks within the DataWindow. You do not need to know the
coordinates of elements within the DataWindow to program control-specific
responses to the user’s clicks. For example, you can prevent editing of a
column and use the Clicked script to set data or properties for the column
and row the user clicks.
A click can also trigger RowFocusChanged and ItemFocusChanged
events. A double-click triggers a Clicked event, then a DoubleClicked
event.
For graphs in DataWindow controls, the ObjectAtPointer method
provides similar information about objects within the graph
control.
PowerBuilder programming
note
The xpos and ypos arguments provide the same values the functions
PointerX and PointerY return when you call them for the DataWindow
control.
Examples
This code highlights the row the user clicked.
1 |
This.SelectRow(row, true) |
If the user clicks on a column heading, this code changes the color
of the label and sorts the associated column. The column name is assumed
to be the name of the heading text control without _t as a suffix.
1 2 3 4 5 6 7 8 9 10 11 |
string ls_name IF dwo.Type = "text" THEN dwo.Color = RGB(255,0,0) ls_name = dwo.Name ls_name = Left(ls_name, Len(ls_name) - 2) This.SetSort(ls_name + ", A") This.Sort() END IF |
See also