[lazarus] Show form no modal!!
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Feb 25 03:53:09 EST 2003
On 24 Feb 2003 17:16:23 -0600
Bruno Alejandro <bruno at vias.com> wrote:
> Hi!!
>
> Look, I have a form, in this form when I click new open a no modal form,
> and this second form, open 3 new no modal form... this is ok, the
> problem is that when I open the second form, instead to create me 1
> instance of each of the 3 forms, create me 2 instances, then I have 6
> forms plus the 1 I created before.
>
> the code of the project is:
>
> uses
> Interfaces,
> Forms, main, idebehavours, ideextensios, ideprop;
>
> begin
> Application.Initialize;
> Application.CreateForm(TfrmFileMgr, frmFileMgr);
> Application.CreateForm(TfrmEditor, frmEditor);
> Application.CreateForm(Tfrmbehavours, frmBehavours);
> Application.CreateForm(Tfrmextensions, frmExtensions);
> Application.CreateForm(TfrmProperties, frmProperties);
> Application.Run;
> end.
>
> when I call the first form TfrmEditor I use:
>
> procedure TfrmFileMgr.NewWindow(Sender: TObject);
> var
> IDEEDT : TfrmEditor;
> begin
> IDEEDT:=TFrmEditor.Create(Application);
> IDEEDT.Show;
> end;
>
> This open me 2 instances, but if I use
The code looks ok. I hope you do not call NewWindow during TfrmFileMgr
construction.
Can you send a complete example (zip or tgz)?
> procedure TfrmFileMgr.NewWindow(Sender: TObject);
> var
> IDEEDT : TfrmEditor;
> begin
> If not Assigned(IDEEDT) then
This does not work. You are testing, if an uninitialized local variable
contains a value. The result depends on the stack and as such is
unpredictable. The above is correct.
> IDEEDT:=TFrmEditor.Create(Application);
> IDEEDT.Show;
> end;
>
> Like I used in other aplications, then it crashes, I don't know why...
>
> Thanks for your time...
Mattias
>
> Bruno Chavez
>
> _________________________________________________________________
> To unsubscribe: mail lazarus-request at miraclec.com with
> "unsubscribe" as the Subject
> archives at http://www.lazarus.freepascal.org/mailarchives
More information about the Lazarus
mailing list