Re: Prevent a Form from Closing after \'OK\'
Hi millsmik,
You didn't mention, what type of form have you trouble with.
Maybe the key event for Fix/Inspect is the Update Record DB After, for Headerless/Detail is one of the All Record* events.
If you issue an error in this event, the OK won't be return.
I recently figured out this solution for one of our clients.
It was a Headerless/Detail without Add and Delete functionalty, and used the All Grid Recs Updated event. I still have not tested this on Fix/Inspect.
In my solution, if there is no error on the form, then issue an error for a dummy hidden control and Press Button(HC Find).
In the Button Clicked event of the Find, I clear this error on the dummy control, so it is invisible for the user.
The safest way, to add a dummy, hidden control which hasn't any attached validation - to hold the error temporaly, instead of using an already existing one for this purpose, which maybe has its own error handling, validation in the application.
If you don't want this OK/Find combination, then:
1.) Disable the OK.
2.) Create your own "OK" (Hyper Control or Push Button).
3.) Call the OK from your own OK.
4.) Set the error in one of the previously metioned event.
5.) Clear the error in your own "OK" after you called the "real" OK.
Please, let us know, does it a solution for you?
Regards,
Zoltán