Now I want to do some code in the OnClick event for the Ok button and not
allow exit in some conditions.
The problem I have is this:
If I do any code in the OnClick event for mrOk, mrCancel is returned as the
modal result. If I don't do any code, mrOk is returned.
???
How do I achieve this, and why is mrCancel being returned when the
ModalResult is set to mrOk?
Crispin,
Within the code for the Ok button try
if (not what i want) then
exit;
that will stop the default processing of the OnClick event and
stop the form from closing. If you want to allow the form to close,
but not return mrCancel, try this:
if(not what i want) then
ModalResult := mrNone;
Close;
end;
I Hope this helps.
Good Luck,
Mike
if Validate then
ModalResult := mrOk
else
{ do something else}
--- x
Xavier Pacheco (TeamB)
Visit us at:
www.xapware.com/xmas.htm
Sorry but TeamB cannot answer support questions received via email.
set the forms ModalResult to mrNone in your handler to prevent the form from
closing. If you see mrCancel returned when the OK button is clicked it has to
be something you do in your code that is causing this, it certainly does not
happen on its own.
Peter Below (TeamB) 10011...@compuserve.com)