Actually, this should not be that difficult, if you just use the
proper event in your code. Are you satisfied with knowing the form
that was open before your Form3 opened? Because in that case, just
take a look at the Screen.Forms property. 

The Screen.Forms property stores all your forms in Z-order. The top
form will be Screen.Forms[0]. The form that was open prior to the top
form will be Screen.Forms[1]. So all you have to do is use
Screen.Forms[1] to go back to the previous form.

This could result in some fun cases, if your forms are non-modal. Say
you have form1 and form2 open. In Form1 you click to open Form3. Then
you activate Form2 and go back to Form3 again. If you then close
Form3, it will jump back to Form2, not Form1, since Form2 was the form
that was active before you jumped back to Form3.
Of course, when you create Form3, you could instead get the value of
Screen.Forms[0] and store it in some form variable. Then when Form3 is
closed, you just activate that form again. But in this case you have
to get Screen.Forms[0] since Form3 hasn't showed itself yet.
You could also use Screen.Forms[0] in the OnShow event of Form3.
Something like this:

type
  TForm3 = class(TForm)
    procedure FormShow(Sender: TObject);
    procedure FormHide(Sender: TObject);
  private
    FForm3Parent: TForm;
  public
  end;
...
procedure TForm3.FormShow(Sender: TObject);
begin
  FForm3Parent := Screen.Forms[0];
end;

procedure TForm3.FormHide(Sender: TObject);
begin
  FForm3Parent.Show;
end;

Now, forget about those complex solutions the others provided. This
one will work just fine. :-)

And guys, keep it simple, okay?

With kind regards,
X Katja Bergman.

--- In [email protected], Curtis cloud <[EMAIL PROTECTED]> wrote:
> Here is my problem.
>  
> I have three forms total: form1, form2, and form3. Form1 and form 2
has the ability to call form3. 
>  
> Also, form 1 and 2 has timers that are triggered when they receive
focus. Form3 has a close event associated to it. 
>  
> After form3 has been called by form1 or form2, then closes form3
should revert back to the form that called it which, by design, should
activate its timer.
>  
> Does anyone know how to do this....
>  
> If I can get the previous form's name, that will do it for me..
>  
> R/Kurt..





------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hao5n47/M=362335.6886445.7839731.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123853299/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to