[Lazarus] Bug 15390 and Showmodal

patspiper patspiper at gmail.com
Wed Apr 18 21:15:13 CEST 2012


On 18/04/12 22:01, Martin wrote:
> On 18/04/2012 19:26, zeljko wrote:
>>
>> On Wednesday 18 of April 2012 20:05:35
>> patspiper wrote:
>>
>> > On 18/04/12 20:09, Martin wrote:
>>
>> > > On 18/04/2012 17:53, patspiper
>> wrote:
>>
>> > >> On 18/04/12 17:39, Martin
>> wrote:
>>
>> > >>> But this is not a bug.
>>
>> > >>> And Delphi docs, IMHO are
>> not making a 100% clear statement about this.
>>
>> > >>
>>
>> > >> It is a bug considering that
>> both Delphi and Lazarus docs are clear
>>
>> > >> about it: ShowModal does not
>> return until the form is closed.
>>
>> > >
>>
>> > > That's not the point
>>
>> > >
>>
>> > > The point is: Close <>
>> Destroy
>>
>> > > In fact, with modal active close
>> does hide the form (and sets modal
>>
>> > > result)
>>
>> >
>>
>> > Closing a modal form hides it indeed,
>> sets ModalResult, and makes
>>
>> > ShowModal exit. Hiding is just one step
>> of modal form closing.
>>
>> >
>>
>> > > In anyway it does not say "until
>> the method close is called".
>>
>> > > It says "form is closed" never mind
>> how it is closed
>>
>> >
>>
>> > Correct
>>
>> >
>>
>> > > "closing a form" is not the same as
>> "calling close()"
>>
>> > >
>>
>> > > "calling close()" is only one of
>> many ways to "close a form".
>>
>> > > e.g during Modal, you can set
>> ModalResult.
>>
>> >
>>
>> > OK
>>
>> >
>>
>> > > Depending on close the property
>> CloseAction = caHide, a call to
>>
>> > > Close(), does in the end actually
>> call Hide (or set Visible=False).
>>
>> > > The call to Close can (optional)
>> destroy the form. But the actual
>>
>> > > closing is done by making it
>> invisible.
>>
>> > >
>>
>> > > So who says, that calling Hide() is
>> not a way of closing the form?
>>
>> >
>>
>> > Try applying the same logic with
>> CloseAction = caNone ;)
>>
>> >
>>
>> > Furthermore, Hide() does not trigger the
>> OnCloseQuery and OnClose events.
>>
>> >
>>
>> > > It does the same thing. (the 2
>> calls have different additional side
>>
>> > > effects, but that is a different
>> story)
>>
>> >
>>
>> > <joking mode on> Pulling off the
>> computer's power plug is yet another
>>
>> > way of closing a form with different
>> side effects<joking mode off>
>>
>> >
>>
>> > Finally, the force (Delphi) is not on
>> your side :D
>>
>>
>>
>>
>>
>> Maybe I will implement it to be delphi compat
>> but first must test it on all platforms. Also I would like to
>> have property inside TCustomForm which can
>>
>> change behaviour of ShowModal() when Hide()
>> is called.
>>
>> 1.I like current implementation because you
>> can have "alive" form to show again and again.
>>
>> 2.Delphi implementation just hides form but
>> stays in modal loop, and other forms are accessible - I don't
>> like this solution but I respect other ppl needs.
>>
>>
>>
>> So what property name could be goodfor such
>> behaviour ?
>>
>> HideModalBehaviour = hmbLazarus (default),
>> hmbDelphi( Delphi compatibile) ?
>>
>>
>
> I don't thing it's worth a property.
>
> 1) Close can always be used for current behaviour.
> 2) Hide and the setting ModalResult can be used too
+1

Stephano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120418/581b924e/attachment-0003.html>


More information about the Lazarus mailing list