Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Column Order & ActiveColumn Property
Message
De
07/04/1999 12:33:53
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Grid Column Order & ActiveColumn Property
Divers
Thread ID:
00206045
Message ID:
00206045
Vues:
58
G'day. Found a real nasty with grids. In my app, I need to access the currently active control in a grid in order to extract a property.

For a grid, '_screen.activeform.activecontrol' does NOT return the active control, but the grid itself. So I wrote some code use the "activecolumn' propery of the grid to get the column from the 'columns' collection of the grid, then find the active control there. It works like a charm. EXCEPT if at design time I changed the order of the grid columns by setting the 'columnorder' propery. The 'activecolumn' propery of the grid returns the column number AS DISPLAYED ON THE SCREEN. It is NOT an valid index into the "columns" collection.

For example, if I have a grid with three columns, and I have changed the columnorder propery so that "column2" is displayed as the third column, and "column3" is displayed as the second column, if I have selected a cell in "column3", the 'activecolumn' property returns 2, the displayed position of the column, rather than 3, which is its index in the columns collection.

Has anyone got a workaround for this? How can I find the current column and the active control?

You can't just search through the columns looking for one with it's 'columnorder' property set to the 'activecolumn' propery, since the 'columnorder' numbers do not have to be continuous. You can set them as 1,3,8,12 and the columns will appear in the proper order. One option is build an array, sort it on 'columnorder' and then index into that, but it sounds messy.

HELP!

Larry
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform