[Lazarus] Mantis bugid 0015390 - showmodal closing when hide called.
Justin Smyth
delphian at smythconsulting.net
Wed Apr 18 13:58:55 CEST 2012
Now Works thankyou.
added notes to the mantis bug id
tx.
----- Original Message -----
From: zeljko
To: Justin Smyth
Sent: Wednesday, April 18, 2012 6:07 PM
Subject: Re: [Lazarus] Mantis bugid 0015390 - showmodal closing when hide called.
On Wednesday 18 of April 2012 00:39:46 Justin Smyth wrote:
> You have it wrong.
>
> as per other comments showmodal SHOULD NOT exit till the form is closed
>
> an example of live code in one of my products
>
>
> main form of my media player , it gets hidden to show a trayicon, when the
> user clicks show it unhides , if i had to create the form again i would
> have to re init all the components on the main form .. thats crazy. where
> as hide and show just changes the visible component of the form. if you
> exit the showmodal it is wrong .. only when the form is close should show
> modal finish.
>
>
> do i make my point clear ? you are completely wrong assuming hiding the
Yes.
> form should close the form. you are breaking compabity with programs
> ported from delphi. sorry if i seem rude but this has caused great issues
> in a product used in the work place
Didn't know that delphi behaves like that (I don't have delphi at all) , so I'll see what's needed to be done to achieve that scenario (and how it will work on all platforms).
> please fix this or remove this peace of code.
What piece of code ?
zeljko
>
> Justin
>
> ----- Original Message -----
> From: zeljko
> To: Justin Smyth
> Sent: Wednesday, April 18, 2012 12:29 AM
> Subject: Re: [Lazarus] Mantis bugid 0015390 - showmodal closing when hide
> called.
>
> On Tuesday 17 of April 2012 16:01:30 Justin Smyth wrote:
> > sample code uploaded to mantis.
> >
> >
> >
> > i'm not doing anything fancy
> >
> >
> >
> > The Main form has a button which creates a new form , does a show modal
> > and
> >
> > free's it when its finished ( Closed ) i've put in a messagedlg to show
> >
> > when its been finished.
> >
> >
> >
> > the Second form on formactivate ( and tested in formshow) i turn on a
> > timer
> >
> > and that time when the timer event is run it does
> >
> >
> >
> > timer1.enabled:=false;
> >
> > hide;
> >
> >
> >
> > soon as the hide happens is when the showmodal exits.
>
> And your example shows same mistake.
>
> 1.you create modal form
>
> 2.called showmodal (inside show modal you called Hide; via timer) - of
> course modal loop is finished when an modal form is hidden, and then your
> dialog is shown, and after that you are freeing that form .. so what do
> you expect ?
>
>
>
>
> Here is code which works 100% (frmShowModal is already created inside lpr
> - so autocreated form, and no need to create another one).
>
> Change code in ShowModalMain.pas of your example like this:
>
>
>
>
> procedure TForm1.Button1Click(Sender: TObject);
>
> begin
>
> // frmShowModal := TfrmShowModal.Create(self);
>
> frmShowModal.ShowModal;
>
> Messagedlg('frmShowModal Exited',mtwarning,[mbok],0);
>
> // frmShowModal.free;
>
> end;
>
>
>
>
> You should not Free modal form after showModal if you want it to be
> "live" for hiding and showmodal or show again later.
>
> When you call Hide; on modal form, it hides it self and modal loops
> stops.When modal loop stops in such case your previously modal form is
> just like any other hidden form.
>
>
>
>
> zeljko
>
> > Justin
> >
> > ----- Original Message -----
> >
> > From: zeljko
> >
> > To: Justin Smyth
> >
> > Cc: lazarus at lists.lazarus.freepascal.org
> >
> > Sent: Tuesday, April 17, 2012 7:12 PM
> >
> > Subject: Re: [Lazarus] Mantis bugid 0015390 - showmodal closing when
> > hide
> >
> > called.
> >
> > On Tuesday 17 of April 2012 11:05:08 Justin Smyth wrote:
> > > Yeah i will bring post a example over the next few days
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > what plat forms was it tested on ?
> >
> > I've tested qt, gtk2 (linux) , win32 and qt (windows) and qt under
> >
> > macosx.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > zeljko
> >
> > > ----- Original Message -----
> > >
> > >
> > >
> > > From: zeljko
> > >
> > >
> > >
> > > To: lazarus at lists.lazarus.freepascal.org ; Justin Smyth
> > >
> > >
> > >
> > > Sent: Tuesday, April 17, 2012 4:27 AM
> > >
> > >
> > >
> > > Subject: Re: [Lazarus] Mantis bugid 0015390 - showmodal closing when
> > >
> > > hide
> > >
> > >
> > >
> > > called.
> > >
> > > On Monday 16 of April 2012 16:28:09 Justin Smyth wrote:
> > > > I've noted this but was fixed on the 21-2 this year but i've just
> > > >
> > > >
> > > >
> > > > upgraded
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Lazarus from 35368 to 36784 and have found this issue still exists.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Basically i Create and ShowModal my applications main form , once
> > > > it
> > > >
> > > >
> > > >
> > > > hits
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > formshow it starts a thread to monitor another application and once
> > > > a
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > trigger condition is met this form is hidden ( to prevent the user
> > > >
> > > > from
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > entering data until other applications have finished there data
> > > > look
> > > >
> > > >
> > > >
> > > > up)
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > and i show the form again once its been populated with new data .
> > > > but
> > > >
> > > >
> > > >
> > > > with
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > the hide the showmodal exits ( which i dont want to happen, the
> > > > form
> > > >
> > > >
> > > >
> > > > hasnt
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > closed it just hidden while i wait for some data to come back from
> > > >
> > > >
> > > >
> > > > another
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > application).
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I almost think a variable of IsHidden might be needed so that block
> > > >
> > > > of
> > > >
> > > >
> > > >
> > > > code
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > assoated with bugid 15390 doesnt get called ( or the break in that
> > > >
> > > >
> > > >
> > > > section
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > doesnt get called).
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I can provide code if needed , i'd have to bring it home from work
> > > >
> > > > but
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > thats ok ( From Telstra) Thanks.
> > >
> > > You must provide example. It works for me, also example which is
> > > added
> > >
> > > by
> > >
> > >
> > >
> > > Stephano today is wrong.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120418/64011b8b/attachment-0003.html>
More information about the Lazarus
mailing list