Thanks Chris

But it seems a bit long winded

How does this compare with GetTopParentHandle or Screen.ActiveForm.Handle

Regards
Neven


----- Original Message -----
From: Chris Reynolds <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Thursday, 3 February 2000 21:29
Subject: RE: [DUG]: AutoExiting a Control


> function getParentForm(wc:TwinControl):Tform;
> var
>   parentControl :TWinControl;
> begin
>   try
>   parentControl := wc.Parent;
>   while not ((parentControl is Tform) or (parentControl =nil)) do
>     parentControl := parentControl.Parent;
>   result := parentControl as Tform;
>   except
>     on E:exception do
>       if wc<>nil then
>         raise exception.create('Failed to get parent form for
> '+wc.name+'Name : '+e.message);
>   end;
> end;
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Neven MacEwan
> Sent: Thursday, February 03, 2000 5:04 PM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: AutoExiting a Control
>
>
> Thanks Aaron and Martin
>
> Isn't a bitch that we have learn all the time!
>
> Okay last simple question - from a control how to I find its form?  so I
can
> get the Handle?
>
> Regards
> Neven
>
>
> ----- Original Message -----
> From: Martin Ease <[EMAIL PROTECTED]>
> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> Sent: Thursday, 3 February 2000 16:52
> Subject: RE: [DUG]: AutoExiting a Control
>
>
> > Neven
> >
> > To move to the next control you could also use something like:
> >
> > PostMessage(MyHandle, WM_NextDlgCtl, 0, 0);
> >
> > where MyHandle is the handle of the parent form.
> >
> > HTH
> >
> > Regards
> > Martin
> >
> >
> > -----Original Message-----
> > From: Neven MacEwan [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, February 03, 2000 4:29 PM
> > To: Multiple recipients of list delphi
> > Subject: Re: [DUG]:  AutoExiting a Control
> >
> > Aaron thanks for the tip - but to make it work I had to
> >
> >   TnkmParent = class(TWinControl)
> >   protected
> >     procedure GotoNextControl(From: TWinControl);
> >   end;
> >
> > with
> >
> > procedure TnkmParent.GotoNextControl(From: TWinControl);
> > var
> >  C: TWinControl;
> > begin
> >   C := FindNextControl(From,True,True,False);
> >   if C <> nil then C.SetFocus;
> > end;
> >
> > and then in my component
> >
> > procedure TnkmCustomEdit.AutoExit;
> > var
> >   P :TnkmParent;
> > begin
> >   P := TnkmParent(Parent);
> >   P.GotoNextControl(Self);
> > end;
> >
> >
> >
> > "WorldSecure <sovereign.co.nz>" made the following
> >  annotations on 02/03/00 16:49:59
>
> --------------------------------------------------------------------------
> ----
> >
> > [INFO] -- Content Manager:
> > This e-mail message and any attachments are confidential to Sovereign
> Limited and subsidiaries and subject to legal privilege. If you have
> received this e-mail in error, please advise the sender immediately and
> destroy the message and any attachments. If you are not the intended
> recipient you are notified that any use, distribution, amendment, copying
or
> any action taken or omitted to be taken in reliance of this message or
> attachments is prohibited.
> >
> >
>
============================================================================
> ==
> >
>
> --------------------------------------------------------------------------
> -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> >
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to