Yes a common problem for apps with embedded forms. I imagine your main form
has some sort of control event to handle the swapping of forms e.g
pagecontrol or a like. Its from here you need to fire activate or deactivate
events in your embedded forms. I'm sure you can think of plenty of ways of
achieving this.
One solution maybe to have your embedded forms in a control array ( e.g
ChildForms : array[1..MaxForms] of TForm; ) this makes it easier to cycle
through your forms with common code. Also
Ive seen other embedded examples where the programmer has used SendMessage
to notify all forms of a state change. Hope this helps. Cheers.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Neven MacEwan
Sent: Friday, October 20, 2000 5:11 PM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Last Active Control on a form
Nello
I prob should have been more specific (and as a result appear less dim)
I have a TPanel which has dynamically created forms as its Controls
Form := TForm.Create(Application);
Form.Parent := Panel;
Form.Align := alClient;
etc
I then have a navigator comp which make on of the forms visible above the
others Using Form.Show
Since all the forms are visible and not the 'ParentForm' I dont get
Deactivate/Activate/visiblity Messages as
I am only changing their Z order
Also I think the form having a parent confuses things!
Thanks
Neven
----- Original Message -----
From: Nello Sestini <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Friday, 20 October 2000 15:34
Subject: Re: [DUG]: Last Active Control on a form
> Neven
>
> > I'm trying to save the last focused control on a form so when I
reactivate
> > it This control has focus
>
>
> write handlers for the form's FormActivate and FormDeactivate events
>
> FormDeactivate needs to save the value of ActiveControl
>
> FormActiveate needs to restore the value of ActiveControl
> (or whatever you're trying to do)
>
> in the form's FormCreate event set Application.OnActivate
> to the FormActiveate handler and set Application.OnDeactivate
> to the FormDeactivate handler.
>
> The form's activate/deactivate events will fire when you
> switch between forms of your application. The Application
> events will fire when you switch between applications.
> Either way you'll be notified because you have both
> situations covered.
>
> -ns
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"