Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Why second form did not show ?
Sat, Apr 29 2017 1:07 PMPermanent Link

CHORHARID

DFX

I tried to read the manual and only want to show two forms.
If all forms is auto create, then it stacks on top of each other.
If I move remove form from auto create, the second one never
show.
I run the sample it works ok.  
Might be a super silly question here.



Attachments: Why.zip
Sat, Apr 29 2017 1:16 PMPermanent Link

CHORHARID

DFX

Sorry, if you even put showmodal instead of show. It will never show.
Sat, Apr 29 2017 1:37 PMPermanent Link

Uli Becker

<< FormPop := TFormPop.Create(nil);
   try
     FormPop.Show;
   finally
     FormPop.Free;
   end;
>>

That won't work because you are freeing FormPop immediately. There is no
reason to do so.

Use this:

if not Assigned(FormPop) then
   FormPop := TFormPop.Create(Application);
FormPop.Show;

That will make sure that only one instance of FormPop is created.

Uli

Sat, Apr 29 2017 2:11 PMPermanent Link

CHORHARID

DFX

Thank you Uli,   

       Now it feels like all over Delphi again.


Uli Becker wrote:

<< FormPop := TFormPop.Create(nil);
   try
     FormPop.Show;
   finally
     FormPop.Free;
   end;
>>

That won't work because you are freeing FormPop immediately. There is no
reason to do so.

Use this:

if not Assigned(FormPop) then
   FormPop := TFormPop.Create(Application);
FormPop.Show;

That will make sure that only one instance of FormPop is created.

Uli
Sat, Apr 29 2017 3:36 PMPermanent Link

Uli Becker

Addition: showmodal works different in EWB and Delphi. In EWB it does *not* wait until the modal form has been closed. It just disables all other forms.

Uli
Image