Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding code to event
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Adding code to event
Divers
Thread ID:
01276895
Message ID:
01276895
Vues:
63
by clicking on the header of a grid column i have code to set order to that column. When creating the recordsource for the grid (which is a cursor) the following code creates index's for each column
** lcRecordsource is the recordsource of the grid
Select (lcRecordSource)
Afields(aFlds,lcRecordSource)
For ix = 1 To This.Parent.grd1.ColumnCount
	lcIx = '"FLD'+Alltrim(Str(ix))+'"'
	lcField = Alltrim(aFlds(ix,1))
	Index On &lcField Tag &lcIx Additive
Endfor
then in the click event of the header for each column in the grid i have the following
lcColIndex ='FLD'+ Alltrim(Str(This.Parent.ColumnOrder))
lcRecordSource = This.Parent.Parent.RecordSource

Select (lcRecordSource)

Set Order To &lcColIndex In &lcRecordSource

Go Top

This.Parent.Parent.Refresh
Currently I am coping and pasting this code in each header click of the grid.

Question is how can I programically add this code when i programically assign the grids recordsource and number of columns?

Thanks in advance
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform