On 18/04/2012 11:53, Hans-Peter Diettrich wrote:
patspiper schrieb:
No, FormClose() isn't called when modal form is hidden via Hide();
Correct
, so form still exists and it can be called with ShowModal() or
Show() again.
I beg to differ here as Showmodal should not exit unless the modal
form is closed.
A modal form (dialog) can be used to accept multiple user entries
(filename...). Then the form object must stay alife until the
application has read all entries. That's why a modal form only hides
itself on exit.
closed <> destroy
Close() depends on close action, which include free and hide.
Close() on a modal Form in LCL ignores close action and always hides (by
setting ModalResult = mrCancel.
Hide() or Visible:=False does not set ModalResult
In fact if in Delphi you hide a modalform, then ShowModal does not
return. I don't know, if this is intended or accidental behaviour.
While of course you can use this, there is a real danger of such a modal
form become hidden, with no means of ever getting it back or exiting it.
Using a hidden modal form, to block all other forms (even if intended)
appears to me an abuse of the modal concept. If an application wants to
do this, it should do this explicitly. (But that is my personal opinion)
In LCL there is
Screen.DisableForms()
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus