Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Mar : Closing non auto-created form.

www.cryer.info
Managed Newsgroup Archive

Closing non auto-created form.

Subject:Closing non auto-created form.
Posted by:"H. Bouty" (hbou..@gmail.com)
Date:Fri, 2 Mar 2007 00:36:19

Hi All,

I made a form, named fmDisplayMessage, contains only a TPanel, TLabel and
Peter Below's animation process.
This form created in a procedure, like :

procedure TForm1.DisplayMessage(MessageToDisplay:string); overload;
var fm : TfmDisplayMessage;
begin
    fm := TfmDisplayMessage.Create(nil);
    try
        with fm do
        begin
            Label1.Caption := MessageToDisplay;
            Update;
            Show; {I prefer this a ShowModal, possible?}
        end;
    finally
        {Here should go the coding for closing it, even it called from
somewhere else?}
    end;
end;

Another procedure to close it :

procedure TForm1.DisplayMessage(CloseIt:Boolean=true); overload;
begin
    if CloseIt then ??? {Close the TfmMessageDialog above};
end;

I could call the first procedure like :

DisplayMessage('This is the first message');
Sleep (2000);
DisplayMessage('This is the second message');

etc... and the Label1 caption updated as I will.

I want to close it by calling DisplayMessage(); but don't know how
to close the form.

Any elaboration from you the experts expected. Thanks.

HB

Replies:

www.cryer.info
Managed Newsgroup Archive