Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Header Click - How to do
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01419010
Message ID:
01419040
Vues:
82
I build the grid in code, and the underlying results can change. If they change, any code that I added in the clikc event of the header goes way. I need to trap the click and execute some code if user selects it.

Code like this called from the grid's Init():
*** 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
ENDFOR
Them, 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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform