Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing/setting grid recordsource on the fly
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00735248
Message ID:
00735253
Views:
8
Hi Kevin,

When a form is initially opened, certain events are fired that will not repeat unless the form is closed and opened again. For example, the load event is important, if it is used to select the tables to be used by the form.

Usually the base class code creates variables to hold the tables to be used by the form. Code in the base clase is run between the load event and the init event to create the form and all its objects based on properties defaults. (e.g. .t. or .f. visible=.t., etc). By the time the init event fire, all objects exit and can be address in the init event you can put code that changes the form's objects, like initial values in objects (e.g. thisform.print_pack_slip.value=.T.). Once this is done, these events will not fire again unless you close the form and re-open it.

If you change the alias of a grid, there could be a problem that the public variable at the base class level holding the old alias name does not get changed. The only way to know for sure is to "set step on" and step through the code that run during your procedures. It might be better in this situation to have two forms. Have form 1 call form two and then relase form 1. Have form 2 build cursor and, when closed, have it call form 1 again and open it fresh. This would insure that the base class has all the proper variables as obtained during running of the load event and the init event and all the code that runs in between these two important events.

This would probably be better than re-writing the code in the txtbtns navigation object of the wizstyle class, if that is the class you are using.

Another alternative would be to change the base class variables with code in your custom form. If I recall correctly, I worked with something like this once and it can be very tricky and frustrating, because the subclassed code has to work very closely with the base class code and it is often difficult to step through code at both levels to determine what is going on.

LelandJ
Leland F. Jackson, CPA
Software - Master (TM)
smvfp@mail.smvfp.com
Software Master TM
Previous
Reply
Map
View

Click here to load this message in the networking platform