Richard R wrote: > yea I kinda goofed on the initial code, but I did set ac:= > Screen.ActiveControl but it still returned nil
I can't say I've set things up exactly like your code; but the following works fine for me: procedure TForm1.FormDblClick(Sender: TObject); var AC: TWinControl; begin AC := self.ActiveControl; AC := FindNextControl(AC, True, True, True); Edit1.Text := AC.Name; AC.SetFocus; end; Each time I double click on the form surface a new Control name gets entered into the Edit box, cycling through the Tab order as I'd expect. So, I think something else must be wrong. Stephen Posey [EMAIL PROTECTED] > > ----- Original Message ----- > From: "Stephen Posey" <[EMAIL PROTECTED]> > To: "Delphi-Talk Discussion List" <[email protected]> > Sent: Monday, October 31, 2005 9:24 AM > Subject: Re: FindNextControl > > > >>Richard R wrote: >> >> >>>Well that FindNextControl function always returns nil. Now I am at my >>>wits >>>end. Any suggestions? >> >>You might want to set "ac" to be equal to something before >>calling FindNextControl, otherwise how does it know where you >>mean for it to start to get the "next" control? >> >> >>>>Well I found out what was wrong. I was accessing it wrong. Seems it is >>>>accessible using it directly without resorting to type casting. >>>> >>>>procedure TMainForm.Tsx1TrapKey(wParm, lParm: Cardinal); >>>>var >>>>kydown: boolean; >>>>ac: TWinControl; >>>>begin >> >> ac := self.ActiveControl; // or whatever >> >> >>>>if (tsxMain = nil) then >>>> exit; >>>>kydown:= (lParm and ($1 shl 31)) <> 0; >>>>if ((wParm = VK_TAB) and kydown) then begin >>> >>> ac:= FindNextControl(ac, True, True, True); >>> >>>> repeat >>>> if Assigned(ac) then begin >>>> ac.SetFocus; >>>> break; >>>> end; >>>> ac:= FindNextControl(ac, True, True, True); >>>> until (ac = nil); >>>>end; >>>>end; >> >>HTH >> >>Stephen Posey >>[EMAIL PROTECTED] >> >>__________________________________________________ >>Delphi-Talk mailing list -> [email protected] >>http://www.elists.org/mailman/listinfo/delphi-talk >> > > __________________________________________________ > Delphi-Talk mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi-talk > > __________________________________________________ Delphi-Talk mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi-talk
