*** now make sure that the dblclick method of all the contained text boxes *** delegate to the grid's dblclick() FOR lnCol = 1 TO This.ColumnCount FOR EACH loControl IN loColumn.Controls IF LOWER( loControl.BaseClass ) = 'header' BINDEVENT( loControl, 'Click', This, 'SortGrid' ) ELSE IF PEMSTATUS( loControl, [dblClick], 5 ) BINDEVENT( loControl, 'dblClick', This, 'dblClick' ) ENDIF IF PEMSTATUS( loControl, [Click], 5 ) BINDEVENT( loControl, 'Click', This, 'Click' ) ENDIF ENDIF ENDFOR ENDFORThem, in the case of my example, you write code like this in the SortGrid() method to find out which control fired off the method and take action based on this information:
IF INLIST( Thisform.cEditMode, [ADD], [EDIT] ) RETURN ENDIF llAllowCellSelection = This.AllowCellSelection *** First of all, see which column fired off this event AEVENTS( laEvents, 0 ) loHeader = laEvents[ 1 ] IF VARTYPE( loHeader ) = 'O' *** First See if a ControlsSource was set for the column WITH loHeader.Parent lcField = '' IF NOT EMPTY( .ControlSource ) *** Cool. Use it to decide how to sort the grid IF NOT EMPTY( .ControlSource ) AND ( '.' $ .ControlSource ) AND NOT( '(' $ .ControlSource ) lcField = JUSTEXT( .ControlSource ) ENDIF ENDIF ENDWITH ENDIF