Aligning, sizing and spacing commands in the Delphi 2007 VCL designer

Guest blogger: I’d like to introduce Jim Tierney, Principle Engineer working on the BDS development team at CodeGear as a guest blogger. Jim made numerous enhancments/improvements to the VCL form designer for Delphi 2007. I also work closely with Jim on the ASP.NET designer.

Prior to Delphi 2007, the “Align” and “Spacing” toolbars were not entirely supported by the VCL designer. Now, operations like “Align left edges” or “Increment horizontal spacing” can be performed by clicking a toolbar button. Delphi 2007 also makes it easier to identify and change the anchor component for these commands.

Align toolbar
The Align toolbar is an alternative to using the Edit|Align… and Edit|Size… commands. To show the Align toolbar, check “Align” on the toolbar popup menu.

The Align toolbar contains alignment commands as well as sizing commands like “Make same width”.  Note that most of these commands are grayed unless multiple components are selected.

The Align commands are: Align left, align right, align vert centers, align tops, align bottoms, align horz centers, align to grid, Snap to grid, make same height, make same width, make same size, size to grid

The Edit|Align… and…

Edit|Size… commands continue to work as in Delphi 2006.

Spacing commands
Spacing commands are new to the Delphi 2007 VCL designer (with the exception of “space equally”).  These commands change the spacing between components.  “Increment horizontal spacing” is an example of a spacing command.

To show the spacing toolbar, check “Spacing” on the toolbar popup menu.  Spacing commands are grayed unless multiple components are selected.

The Spacing commands are: space equally horz, increment horz spacing, decrement horz spacing, remove horz spacing, space equal vert, increment vert spacing, decrement vert spacing, remove vert spacing

Anchor element
When multiple components are selected, one component is the anchor.  When aligning, sizing, or spacing, the anchor component stays in place and the other component(s) are moved or sized in relation to the anchor.

There are two changes to anchor support in Delphi 2007.

  1. Clicking on a selected component makes that component the anchor.
  2. The handles of the anchor component are painted black. Other handles are gray.

In summary, these minor enhancements to the VCL form designer provide new and improved ways to position and size components.

4 thoughts on “Aligning, sizing and spacing commands in the Delphi 2007 VCL designer

  1. When I first saw the checkin that allowed changing the anchor component, I was totally impressed at how such a simple little thing can make a huge difference. I remember always having to remember to select the anchor *first* then select the rest. Now it is a simple matter of just rubber-band selecting a group of components, select the anchor and align or size. Great job, Jim!

  2. I used to say that designing the user interface takes as least as long as the coding (I mostly develop business database apps with lots of visible components and only moderate amounts of code). However things like the design guides and alignment tools has allowed me to chop a good 20% to 30% off my GUI creation time. That was a *major* factor in spurring my move from D7 to 2006. So, at least for me, new compiler technology is great but GUI features bring in sales too.

Comments are closed.