Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Yet Another Grid Bug: Solution?
Message
From
06/05/1998 14:11:55
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00097448
Message ID:
00097453
Views:
21
I had the same _exact_ problem. I couldn't understand it at all because my grid class _used_ to work then one day I get that Expression not valid crap!

I recreated the grid class and I copied all of the default code to the proper methods. I bet you wanted to here something a bit more eloquent yes? :)




>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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform