[Lazarus] Bug 15390 and Showmodal
patspiper
patspiper at gmail.com
Wed Apr 18 18:42:45 CEST 2012
On 18/04/12 16:22, Martin wrote:
> 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.
Correct
> I don't know, if this is intended or accidental behaviour.
It is intended behaviour. Embarcadero docs clearly state:
"ShowModal does not return until the form closes"
Lazarus docs:
"Show this form as modal - ie control cannot be resumed by another form
until the current form is closed"
> 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.
This is fine especially that the same situation arises when the main
form is hidden -> no means of ever getting it back or exiting it. It is
up to the programmer to decide if he opts to hide it.
Stephano
More information about the Lazarus
mailing list