Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prevent User From Leaving Form
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00383396
Message ID:
00384334
Views:
30
Thanks to everyone who replied. I did solve the problem by changing the form's modality on the fly. The root of the problem is that the form can already be open non-modal and editing a record. In the Activate of the form, I check to see if the parameter ID [PK of the source table] of the edited record has changed. If the ID is zero, this is my clue that the form is to add a new record. So, I TableUpdate the current data in the view, zap the view, and append blank. For a new record, I need to force the form to be modal so the user either has to cancel the new record or save it.

If I am editing a record, and the ID changes, I just tableupdate and requery with the new ID. If the ID is the same, I do nothing.

I solved the problem by modifying my oApp.DoForm() method to pass a MODALITY parameter to the INIT. By default, this parameter is false for modeless forms. If the form already exists, I just issue a oForm.Show(1) which changes the form to modal. If the form does not exist, I issue a DO FORM WITH FORM_MODAL [which I have defined in my defaults.h file as FORM_MODAL 1]. Works everytime. The only time I have to issue the parameter is if I need the form to be modal which is very rare.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform