[Lazarus] Fitting a form around a grid

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Fri Jun 17 09:55:13 CEST 2011


Hans-Peter Diettrich wrote:
> Mark Morgan Lloyd schrieb:
> 
>>> If you don't want to calculate the exact amount, you can dimension 
>>> the form sufficiently big, and adjust the columns to fill the form.
>>
>> That's doable for the width, but what about rows where I believe 
>> there's less scope for per-row tweaking?
> 
> Depends on whether the number of rows is fixed, or only known at 
> runtime. I'd adjust for a minimal number of rows, so that the form will 
> not "jump" too much in height, with every occurence.
> 
> As long as there exist only rows of a single line, it should not be so 
> hard to calculate the minimum height of each row, depending on the 
> choosen font. Then bitmaps, of a constant height, will be another factor 
> to consider. Finally there is a choice of adjusting the row height, so 
> that the rows fill the grid, or to shrink the grid to the total rows 
> height.

Assuming the number of rows is known, I'm already doing that and finding 
that I have to adjust by different amounts depending on the widget set: 
I think that the issue is the amount of overhead between a form's size 
and the size of its client space. It would be nice to have a facility to 
specify a precise client size and have the container (i.e. form etc.) 
adjust to that, in other words the exact opposite of the standard situation.

However, I thought yesterday that I was seeing different behavior on 
different machines (possibly based on the gtk2 library version, or on 
DPI) but that was a red herring- lazbuild wasn't rebuilding a unit when 
the target changed. So fortunately I've got nothing intractable here.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list