yea I kinda goofed on the initial code, but I did set ac:= Screen.ActiveControl but it still returned nil
----- 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
