Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Yet Another Grid Bug: Solution?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Yet Another Grid Bug: Solution?
Divers
Thread ID:
00097448
Message ID:
00097448
Vues:
55
In the ongoing saga of finding all the different ways you can screw up a grid, I found yet another way. Take the following code which I placed in the init of my grid.


this.setall("DynamicBackColor","IIF(RECNO()=this.nRecNo,RGB(0,255,255),this.BackColor)","column").

Notice that I have a custom property of the grid called nRecNo which holds the number of the current record. To set this, in the AfterRowColChange() event I have the following code:

this.Refresh()

and finally in my Refresh() method I have the following code:

IF !EMPTY(this.RecordSource)
..LOCAL lnSelected
..lnSelected = SELECT(0)
..SELECT (this.RecordSource)
..this.nRecNo = RECNO()
..SELECT (lnSelected)
ENDIF


If you take this customized grid and place it on the form, intially it works great. You have a beautiful blue color for the currently selected row. Even if the grid doesn't have focus you can still see which row is currently selected. You can move up and down the grid and the row will highlight accordingly.

Now, issue a thisform.Refresh().

ACK!
The elegant DynamicBackColor code is suddenly uncouth! The specific error is: Expression is invalid. Use a valid expression for DYNAMICBACKCOLOR property.

If there is one control that needs a complete overhaul in the next version of VFP, it's the grid. Does anyone know a comparable workaround for this without having to place an absurd nRecNo property on a form or some such?

Michael G. Emmons
memmons@nc.rr.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform