in Delphi Tips :: In any decently complex form design you will probably have edit controls (edit boxes, drop down lists, radio buttons, check boxes, etc) contained within a parent container control (TPanel, TGroupBox, ...).
In any data aware (database) application you probably have db-aware controls dropped on some container connected to a TDataSource connected to a TDBNavigator.
When you click the "Edit" or "Insert" buttons on the DBNavigator you want the "first" control in the group to receive the input focus - to allow for faster data input.
In any data aware (database) application you probably have db-aware controls dropped on some container connected to a TDataSource connected to a TDBNavigator.
When you click the "Edit" or "Insert" buttons on the DBNavigator you want the "first" control in the group to receive the input focus - to allow for faster data input.
Read the full article to learn how to Focus the First Entry Control in a Container
Related:

Nice aproach. But if you for instance put a TButton on a group box before you put any Edit boxes your code will aways set focus to this Button. Why? Becouse TButton is also TWinControl.
@Silver: Yes, you’re right. Could apply some refactoring….