Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New approach to avoid grid reconstruction
Message
From
09/04/2001 06:18:46
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
New approach to avoid grid reconstruction
Miscellaneous
Thread ID:
00493470
Message ID:
00493470
Views:
71
Hi!

Di you know that BeforeRowColChange event is fired each time when grid is going to be reconstructed? It happens in any case include when grid alias closed, view requeried etc. despite grid visibility, focus and grid configuration. the most amazing is that putting NODEFAULT in this event for duration of data changes prevents grid reconstruction at all!

Old method:
thisform.Grid1.RecordSource=""
... && do requery of data
thisform.Grid1.RecordSource="MyAliasWithNewData"
* than restore control sources of all columns
Now you can do following:
thisform.GridRefreshing = .T. && tell all grid controls that grid data going to be requeried
... do data requery
thisform.Refresh && or grid refresh
thisform.GridRefreshing = .F.
In the BeforeRowColChange of grid event put following:
if PEMStatus(thisform,"GridRefreshing",5) AND thisform.GridRefreshing
    nodefault
    return
endif
You can put above in the grid class.

The most fun is that this method do not require to organize restoring of the control sources of all columns.

Unfortunately, there are no way to know the reason why BeforeRowColChange event is called inside of that event to distinguish if it is called for recornstruction or movement between cells or some other actions with grid. Just use a flag for that.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Next
Reply
Map
View

Click here to load this message in the networking platform