views:

139

answers:

2

I have a DBGrid above a group box with some buttons and edit fields and another group box below that again with some buttons. I cannot fins a setting for the align and/or anchors for the DBGrid and the group boxes so they fill the form without overlapping or leaving blank bits of form.

I am using Delphi 5 on XP Pro with all updates installed.

+1  A: 

If I remember, there is no built-in way to do this. When I did this in Delphi I implemented it manually in the event handler for the form resize event. You can recalculate the new positions for each control based on the size of the form and the proportions of the layout you want. You can simplify it by breaking the form in to panels and setting most of the controls to align to one or more edges of their parent panel. That way you mostly just have to resize a few panels. If you have a complex form you still might need to reposition some individual controls.

You might also find a third-party container control out there which makes this easier. I would search for combinations of "flow", "layout", "table", "container".

Charles
Agreed. I've found that a little bit of code in resize events coupled with careful choice of alignments and panels does a good job of it. I also have written a few library routines that evenly space things like buttons on a panel.
Loren Pechtel
A: 

We've struggled with this as well, and I agree with Charles M that there is no built-in way to do this.

If you're looking for an outside solution, the ExpressLayout control from Developer Express allows you to fine-tune the positioning of controls on Delphi forms. They advertise "Screen Resolution Independence - Automatically Resizable Interfaces - Look & Feel Standardization...", so it might be worth looking into.

I've never used that particular control, but we use a lot of other Developer Express controls in our commercial projects. The controls and support are excellent.

See: http://www.devexpress.com/Products/VCL/ExLayoutControl/

They don't have a trial version, but do have a 60-day no-questions-asked money-back guarantee.

Johnula