IDE Tip: Selecting the form

by Kent Reisdorph

It is not uncommon to have a form entirely covered by components. For example, you may have a tree view, list view, memo, panel or any other component aligned to the client area of the form. The result is that no part of the form’s client area is uncovered. Setting a property or event of the form, obviously, requires you to first select the form. Selecting the form is not possible by clicking on it in this case. There are at least two ways to go about selecting a form covered by other components.

The first way to select the form is to simply use the component selector combo box at the top of the Object Inspector. This certainly works, but the form can be hard to find amongst the other listed components. This is particularly problematic when the form is a main form where, not only are the form’s components listed, but also every menu item. Finding the main form in the list takes time.

The second way to select the form is much easier and often overlooked. Simply click on any component on the form and hit the Escape key. When you do, that component’s parent is automatically selected. For example, if you have a simple form with a memo aligned to client, hitting ESC will select the form.

This method can be used to select any container component. Consider the example where you have a panel aligned to client and a memo on that panel, also aligned to client. Select the memo and hit ESC; the panel is selected. Hit ESC one more time and the form is selected. This technique allows you to quickly select any component that is otherwise impossible (or inconvenient) to select by clicking with the mouse.

You may find this tip simplistic if you are already familiar with this IDE feature. However, I find many people who are unaware of this feature, some of whom have been using C++Builder for years.