Still too complex... I've suggested a much better solution already.
Much easier too. You guys are all thinking too complex about this
problem. It's just so easy...

Screen.Forms...

With kind regards,
X Katja Bergman.

--- In [email protected], Vahan Yoghoudjian <[EMAIL PROTECTED]> wrote:
>     How are you creating your forms?
> 
> Application.Create(TForm3,Form3) ????
> 
> I suggest you write a class function in form3 that will take as
parameter
> the form that has launched it.
> 
> in example
> 
> private
>   FParentForm: TForm
> 
> class function TForm3.LaunchForm (aParentForm: TForm): TForm
> begin
>   Screen.Cursor        := crHourGlass;
>   Result                    := nil;
>     Application.CreateForm (Self, Result);
>     Result.FParentForm := aParentForm // here you will assign the parent
> form that launched your form3 and
>                                                          // was
passed as
> parameter to a local variable declared in your private
>                                                          // section and
> before closing this form you can work on that
>                                                         //  FParentForm
>     // You can insert here any other initialization you want to do
on the
> form before showing it
>     Result.Show;
>     except
>       Result.Release;
>     end;
>   finally
>       Screen.Cursor := crDefault;
>   end;
> end;
> 
> Now you will launch form2 on button click let's say as:
> TForm3.LaunchForm(Self);
> 
> Haven't tried exactly this situation but I have similar situtation
that work
> all fine and very stable...
> 
> Good luck
> Let me know what happens
> 
> Vahan
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf
> Of Katja Bergman
> Sent: Friday, August 12, 2005 1:24 PM
> To: [email protected]
> Subject: [delphi-en] Re: How to get the name of the previous form.
> 
> 
> 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..
> 
> 
> 
> 
> 
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> 
> 
> 
>
----------------------------------------------------------------------------
> ----
> YAHOO! GROUPS LINKS
> 
>   a..  Visit your group "delphi-en" on the web.
> 
>   b..  To unsubscribe from this group, send an email to:
>    [EMAIL PROTECTED]
> 
>   c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
> 
> 
>
----------------------------------------------------------------------------
> ----
> 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12ho7pjm4/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123855652/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</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