Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DynamicBackColor invalid expr if the grid has focus else
Message
From
22/05/2008 17:10:49
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01318705
Message ID:
01319129
Views:
16
>As someone said, the problem may lie in the fact you're using this in your expression. What this is referring to?

Like Çetin said, in dynamic*, this==TheGrid, and any other way of referencing will actually break it sooner or later - the grid can get renamed, it can be moved into or out of a container, to another page of a pageframe etc. With This, it stays encapsulated.

>Try to provide the whole reference to the grid including the form, e.g.
>
>if (myAlias.myID <> 0 and thisform.myGrid.... , onecolor, anothercolor)
>
>Or better have it as a separate form's method.

Method calling in a dynamic* property may be nice for a few columns and rows on a fast machine, specially if the method has a short address, but it's actually quite an expensive way to have a dynamic thing on your grid. Dynamic* properties are eval()uated (in the context of the grid, i.e. this==TheGrid) for every refresh, for every visible cell.

For really busy grids, I don't even want expressions - I use simple fields from the same cursor, and programmatically stuff the values into them (integers for colors, logicals for bold, character fields for dynamiccontrol), which VFP then only reads, and doesn't recalculate each n milliseconds. I write them when something happens that may change them. I had a grid with about 30 visible rows and about 20 visible columns (out of 30+) - and maybe the user had a higher resolution video than I did, and resized the columns to show even more of them. This could become slow really soon had I used method calls for dynamic properties.

As for Bhavbhuti's problem, it may well be that during the shutdown of the form, the grid gets one last kick at a refresh (I've seen mine do that) when the current alias isn't what you think it should be. So just aliasing the iID field may be enough - we'll see when Friday visits India.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform