How to Trap a Double Click on a List Box

Top  Previous  Next

Trapping a DOUBLE-CLICK on a list box is built into the Clarion and ABC BrowseBox templates.

To trap a DOUBLE-CLICK on a list control in hand-code:

1.

Establish an ALRT(MouseLeft2) attribute on the LIST control.

2.

Trap for EVENT:AlertKey on the LIST control.

3.

Trap for the MouseLeft2 keycode, as in the following example:

ACCEPT

CASE FIELD()

OF ?List

 CASE EVENT()

 OF EVENT:AlertKey

  IF KEYCODE() = MouseLeft2

   CurrentSel = CHOICE(?List1)  ! Get current selection in list box

   GET(TheQueue, CurrentSel)    ! Get corresponding data from queue

  END

 END

END

The above code finds out what item the user DOUBLE-CLICKED on using the CHOICE() function, then uses the GET() function to retrieve the item from the QUEUE.

When using the ABC templates, the recommended embed point can be found in the TakeKey method. In the Clarion template chain, use the Browse Double Click Handler embed.