The Form Designer is the form you see and use at design-time and not the form you see at run-time.
The Form Designer is used to hold your
components that are either visual or non-visual, you can see the non-visual
components at design-time but not at run-time.
Each form has one unit associated with
it.
Text DFM Files:
New with Delphi 5 Borland has added the ability for you to save new DFM files as text or binary.
To change this setting go to the Delphi
menu click on Tools|Environments Options then click on the Preferences
tab
to the left you will see New Forms
As Text change this as you want.
With DFM files saved as text you have the ability to make changes to the text DFM file in a text editor.
Note: In order for older versions of Delphi to use your programs you will have to disable this option, because older versions will be expecting a binary DFM file.
Adding Components To The Form:
It is simple to add components to your
forms, just click on the component in the Component Palette and then click
on the form where you want the component to be.
You can double-click on a component on
the Component Palette and that component will appear on the center of your
form. This is a fast way to add a component to your form.
You can Shift-Click on a component to add
many copies of that component to a form. In other words hold down the Shift
key and then click on a component, a blue frame can be seen around the
selected component on the Component Palette.
Next just click on the form where you
want the component/s to be.
To stop doing this you click on the arrow
on the left of the Component Palette.
Moving A Component:
If you want to move a component just drag
it where you want it to be using your mouse.
You can also hold down the Ctrl key and
use the arrow keys to move the components, this also works if you select
more than one component.
To move in bigger steps, hold Shift +
Ctrl + Arrow Key.
Resizing Components:
You can also resize a component by dragging
its corners or sides to get the size and shape you want, when the component
is selected you will see small black squares, you can use these squares
to resize the component.
You can also select a component and use
Shift + Arrow Key.
Selecting Many Components And Manipulating Them All At Once:
You can do this by dragging out a selection rectangle around the components with the mouse, another way to do this is to hold down the Shift key and then click on each component you want to select.
Once you have selected many components you can change the properties that are common to all the selected components, these will be visible in the Object Inspector.
You should not attempt to change the Name property of selected components, the Name property is unique to all components and should only be changed if one component is selected.
The Form Designer Grid:
You have the option of using the Form Designer
Grid which can be used to help you align components.
To remove or add the grid go to the Delphi
menu and click on Tools | Environment Options then click on the
Preferences
tab. You will see the Form Designer options there and you can check or
uncheck Display grid.
These are all the options available for
the Form Designer grid:
If you add a component to the Form Designer then that component becomes the child of the form, the form is the parent.
If you add a TPanel to a form it will have
the name Panel1, then if you put a TButton component on Panel1 the button
will be the child of Panel1, so Button1 will be the child of Panel1.
If you put the button on the form instead
of Panel1 then the form is the parent of the button.
Once the button is placed on the panel
it can only move around on the panel, you cannot drag the button off the
panel - try it!
If you drag the panel on the form you
will notice that the button stays with the panel.
If the button is selected and you want to select the panel then press the Esc key.
If you place a TLabel component on a TPanel component and then change the panels font to bold, both the panel and the label will have the bold font, the label inherits its parents bold font, you can also do this with other properties as well such as ShowHint etc.
The Form Designer Speedmenu:
If you right-click on the Form Designer you will see the speedmenu.
Tab:
You can change the tab order of the components
on the form so that your program users can use your software without a
mouse and instead use the Tab key and in such a way that it is easy for
them to move from one component to another in a helpful order.
In the Object Inspector you will find
the TabStop property, if this is set to true, then the user can
tab to another control and the control is in the tab order. If it is set
to false then pressing the Tab key will not allow the user to move
to the next control and the control is not in the tab order.
The Tab Order indicates the position of the control in its parent's tab order. This only works if the TabStop property is set to true.
type TTabOrder = -1..32767;
property TabOrder: TTabOrder;
You can right-click on the form at design-time
and you will see the menu item Tab Order, click on this to modify the tab
order of the components on the form.
If you add a TPanel (or another component
that can contain other components) to a form at design-time and then add
two buttons to the panel you can then right-click on the panel and change
the Tab Order for those buttons.
Help:
If you need to know more about a component that is on the form at design-time then just press the F1 key.
With some third-party components you can
right-click and you can get help about a component that way.
The ZieglerCollection one components is
an example of this.
Revert To Inherited:
If a form at design-time inherits design
features and properties from another form, you can choose Revert To
Inherited
and this will remove all changes you have
made and the form will go back to its original state.