Board index » delphi » a form can close itself on form show

a form can close itself on form show

Hi EveryBody!

A form can close itself on form show ? like below

procedure TForm1.Button1Click(Sender: TObject);
begin
  form2.showmodal;
end;

procedure TForm2.FormShow(Sender: TObject);
begin
  if SomeCase then
    close;
    ^^^^^-------no effect?
end;

 

Re:a form can close itself on form show


If I remember correctly, you'd have to move the code that closes the form
into it's onActivate event handler.

Russ

willard <will...@mail.tccgeb.edu.tw> wrote in article
<32F488A7.3...@mail.tccgeb.edu.tw>...

Quote
> Hi EveryBody!

> A form can close itself on form show ? like below

> procedure TForm1.Button1Click(Sender: TObject);
> begin
>   form2.showmodal;
> end;

> procedure TForm2.FormShow(Sender: TObject);
> begin
>   if SomeCase then
>     close;
>     ^^^^^-------no effect?
> end;

Re:a form can close itself on form show


Quote
willard <will...@mail.tccgeb.edu.tw> wrote:
>Hi EveryBody!

>A form can close itself on form show ? like below

I've tried it more than once and found that it can't...
If someone has studied this subject further could give
us some explanation it would be great.

I thought that including the Close statement in the
OnActivate event handler would settle it, but it
doesn't either...

--
Diogo Assuncao
d...@ip.pt
http://ip.pt/~ip001485/

Other Threads