Clicked

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 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.


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.

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

See also

ButtonClicked

ButtonClicking

DoubleClicked

ItemFocusChanged

RButtonDown

RowFocusChanged

RowFocusChanging