Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Column Order & ActiveColumn Property
Message
De
12/04/1999 09:36:53
 
 
À
08/04/1999 03:52:38
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206045
Message ID:
00207415
Vues:
18
>>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
>
>
* Some method of grid
>nActiveColumn = .findcolumn(.ActiveColumn)
>
>*grid.findcolumn
>lparameters nColIndex
>local ix
>with this
>	for ix = 1 to .columncount
>		if .columns(ix).ColumnOrder = nColIndex
>			return ix
>		endif
>	endfor
>endwith
Cetin


Nope. Won't work. ColumnOrder values do not have to be contiguous. That is, columnorder values can be 1,5,12,19; all that happens is that VFP displays the columns in that order. The absolute values are not used, just the values relative to one another.

Thanks
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform