Yes, SetFocus will fail. It calls CanFocus which checks whether the control and it's containers are visible. Since the form the button is on isn't visible yet CanFocus will return false and SetFocus will raise an exception.
Note you can call CanFocus yourself if you want to see if a control is focusable. David. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Bird Sent: Wednesday, 10 August 2005 3:58 p.m. To: 'NZ Borland Developers Group - Delphi List' Subject: RE: [DUG] Delphi internals - form events So if the Create event is after the DFM is read and all components exist it looks like the components can be accessed... is there anything that cannot be done....How about button1.setfocus - will this fail in the Create event? (I will experiment, just trying to get to the grips on good practice of what to put where, even Google doesn't shed much light) John B _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
