Pages

Friday, 11 June 2010

EditTable Cookbook - Clearing single row selection

One of the more annoying visual traits we find with the EditTable is with single row selection: There seems to be no way to unselect a row and remove the highlight once it's there, and this can lead to a confusing state when it appears that more than one control has the focus.

We've often been asked how to rectify this as simply setting the SELPOS property doesn't suffice, so here's the solution - we use the Windows API SendMessage function to clear the selection like so...

   $insert logical
   
   equ DTM_SELROW$    to 1083 ; * // ( WM_USER + 59 )
   equ DTPOS_INVALID$ to -3

   hwndEdt = get_Property( @window : ".TABLE_1", "HANDLE" )
   call sendMessage( hwndEdt, DTM_SELROW$, FALSE$, DTPOS_INVALID$ ) 

1 comment:

  1. great...I've always wondered how to do this.

    ReplyDelete