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 the left side of the DataWindow workspace. The distance is given in pixels. |
ypos |
Integer by value. The distance of the pointer from the top of the DataWindow workspace. The distance is given in pixels. |
row |
Long by value. The number of the row the user clicked. If the user does not click on a row, the value of the row argument is 0. For example, row is 0 when the user clicks outside the data area, or in the header, summary, or footer area. |
dwo |
DWObject by value. A reference to the control within the DataWindow under the pointer when the user clicked. |
Web DataWindow client control event information Event name: Clicked
Argument |
Description |
---|---|
row |
Number. The number of the row the user clicked. |
objectName |
String. The name of the control within the DataWindow under the pointer when the user clicked. |
Web ActiveX event information Event name: MouseDown
Argument |
Description |
---|---|
Button |
Number. A value that is the sum of the values of the buttons the user clicked. Values are:
The PowerBuilder Clicked event is always the left mouse button, but in the MouseDown event for the Web ActiveX, you have to check which button was pressed. |
Shift |
Number. A value that is the sum of the values of the modifier keys the user pressed. Values are:
The PowerBuilder Clicked event does not provide information about whether a modifier key is pressed, but in the MouseDown event for the Web ActiveX, you can use the Shift argument to check for modifiers. |
XPos |
Number. The distance of the pointer from the left side of the DataWindow workspace. The distance is given in pixels. |
YPos |
Number. The distance of the pointer from the top of the DataWindow workspace. The distance is given in pixels. |
Row |
Number. The number of the row the user clicked. If the user does not click on a row, the value of the row argument is 0. For example, row is 0 when the user clicks outside the data area, or in the header, summary, or footer area. |
Name |
String. The name of the control within the DataWindow under the pointer when the user clicked. |
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”.
The DataWindow Clicked event occurs when the mouse button is pressed down, except in the Web DataWindow (see below).
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.
Web DataWindow The Clicked event occurs only in Microsoft Internet Explorer 4 and higher, not in Netscape browsers. When the user clicks on a DataWindow button, the Clicked event occurs before the ButtonClicking event. When the user clicks anywhere else, the Clicked event occurs when the mouse button is released (in other environments, the Clicked event occurs when the button is pressed).
This code highlights the row the user clicked.
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.
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