Recent

Author Topic: TDBGrid - resizing column width "proportionally"  (Read 238 times)

Rainbow6

  • Newbie
  • Posts: 4
TDBGrid - resizing column width "proportionally"
« on: May 13, 2019, 12:21:34 pm »
Hi,

I'm using Lazarus Fixes (2.0.3 SVN 61084) with FPC 3.2.0 - and I have designed a DBGrid with about 7 columns. All columns have a designed width, so that the all fill up the whole available width of the DBGrid area.

What I like to have is, that when the window is resized all columns should get proportionally resized. The resizing factor should be the same to all columns - and all columns should fill up the available width of the DBGrid.

I tried some settings, but couldn't find one, which does exactly that. I'm sure, I missed something.

Thanks in advance

Kind regards,
Daniel

dsiders

  • Full Member
  • ***
  • Posts: 215
Re: TDBGrid - resizing column width "proportionally"
« Reply #1 on: May 13, 2019, 05:50:19 pm »
Hi,

I'm using Lazarus Fixes (2.0.3 SVN 61084) with FPC 3.2.0 - and I have designed a DBGrid with about 7 columns. All columns have a designed width, so that the all fill up the whole available width of the DBGrid area.

What I like to have is, that when the window is resized all columns should get proportionally resized. The resizing factor should be the same to all columns - and all columns should fill up the available width of the DBGrid.

I tried some settings, but couldn't find one, which does exactly that. I'm sure, I missed something.

Thanks in advance

Kind regards,
Daniel

You've got a couple of options:

Include dgAutoSizeColumns in TDBGrid.Options. This will resize columns to fit their content (either the Caption or the Field Value).

Or, set TDBGrid.AutoFillColumns to True to resize columns to the available space in the grid. It might help to adjust the MinSize, MaxSize, and SizePriority values in each column... but in my experience they're not used for auto-fill.

Hope this helps.
Lazarus 2.0.2 / FPC 3.0.4 / Windows 8.1 64-bit