FORMAT() List Box Mouse Click Properties

Top  Previous  Next

The following runtime properties return the mouse position within the LIST or COMBO control when pressed or released.They can also be written to, which has no effect except to temporarily change the value that the property returns when next read (within the same ACCEPT loop iteration). This may make coding easier in some circumstances.

PROPLIST:MouseDownField

Returns the field number when the mouse is pressed. Same as list column as in PROP:COLUMN

PROPLIST:MouseDownRow

Returns the row number when the mouse is pressed.

PROPLIST:MouseDownZone

Returns the ordinal zone number of the field or group when the mouse is pressed.

PROPLIST:MouseMoveField

Returns the field number when the mouse is moved. Same as list column as in PROP:COLUMN

PROPLIST:MouseMoveRow

Returns the row number when the mouse is moved.

PROPLIST:MouseMoveZone

Returns the ordinal zone number of a field or group when the mouse is moved.

PROPLIST:MouseUpField

Returns the field number when the mouse is released. Same as list column as in PROP:COLUMN

PROPLIST:MouseUpRow

Returns the row number when the mouse is released.

PROPLIST:MouseUpZone

Returns the ordinal zone number of a field or group when the mouse is released.

The three "Row" properties all return zero (0) for header text and negative one (-1) if below the last displayed item.

Equates for the following Zones are listed on EQUATES.CLW:

LISTZONE:Field

On a field in the LIST

LISTZONE:Right

On the field's right border resize zone

LISTZONE:Header

On a field or group header

LISTZONE:GroupHeader

Mouse moved/clicked inside the header, but outside of any particular field’s part of the header. Note: a field not in a group is considered as a group by itself.

LISTZONE:ExpandBox

On an expand box in a Tree

LISTZONE:Tree

On the connecting lines of a Tree

LISTZONE:Icon

On an icon (Tree or not)

LISTZONE:Nowhere

Anywhere else

Example:

Que  QUEUE

F1    STRING(50)

F2    STRING(50)

F3    STRING(50)

    END

 

WinView WINDOW('View'),AT(,,340,200),SYSTEM,CENTER

        LIST,AT(20,0,300,200),USE(?List),FROM(Que),HVSCROLL, |

        FORMAT('80L~F1~80L~F2~80L~F3~'),ALRT(MouseLeft)

       END

 

SaveFormat  STRING(20)

SaveColumn  BYTE

Columns     BYTE,DIM(3)

 

CODE

OPEN(WinView)

Columns[1] = 1

Columns[2] = 2

Columns[3] = 3

DO BuildListQue

ACCEPT

CASE EVENT()

OF EVENT:PreAlertKey

 CYCLE                               !Allow standard LIST clicks to process

OF EVENT:AlertKey

 IF ?List{PROPLIST:MouseDownRow} = 0 |              !Check for click in header

  AND ?List{PROPLIST:MouseDownZone}<>LISTZONE:Right !but not the resize zone

  EXECUTE Columns[?List{PROPLIST:MouseDownField}]   !Check which header

   SORT(Que,Que.F1)

   SORT(Que,Que.F2)

   SORT(Que,Que.F3)

  END

  SaveFormat = ?List{PROPLIST:Format,?List{PROPLIST:MouseDownField}}

  ?List{PROPLIST:Format,?List{PROPLIST:MouseDownField}} = ?List{PROPLIST:Format,1}

  ?List{PROPLIST:Format,1} = SaveFormat

  SaveColumn = Columns[?List{PROPLIST:MouseDownField}]

  Columns[?List{PROPLIST:MouseDownField}] = Columns[1]

  Columns[1] = SaveColumn

  DISPLAY

  END

 END

END

FREE(Que)

 

BuildListQue ROUTINE

LOOP Y# = 1 TO 9

 Que.F1 = 'Que.F1 - ' & Y#

 Que.F2 = 'Que.F2 - ' & RANDOM(10,99)

 Que.F3 = 'Que.F3 - ' & RANDOM(100,999)

 ADD(Que)

 ASSERT(NOT ERRORCODE())

END