|
Setup: I am working on an app where I would like to resize the columns of a stringgrid whenever the grid resizes (which would occur when the form resizes). I am using MigLayout. Code looks like: I looked for an OnResize for stringgrid and did not see one. I then tried OnResize for the form. That gets called but the Width of the form and for the grid (I tried both) acted like there was no change. What I ended up doing was overriding the HandleResize method of the form (since a width is passed into that method). This works fine, but seems like I am doing this wrong. Is there a better way? Thanks, |
Replies: 2 comments 2 replies
|
Thanks for the clear write-up — and apologies for the slow reply. The 1.
|
|
Quick follow-up: rather than leaving this as "something we're considering", the stretch weights are now implemented and pushed to Each column gains a gridResults.ColumnStretch[2] := 2;
gridResults.ColumnStretch[3] := 1;Columns 0 and 1 keep the widths you set, and 2 and 3 split the remainder 2:1. No A few details worth knowing:
Both changes from my earlier reply are on Thanks for raising this — the missing |
Thanks for the clear write-up — and apologies for the slow reply. The
HandleResizeoverride you landed on is actually the idiomatic fpGUI pattern, so you weren't doing anything improper. But you hit two genuine papercuts, and one of them is squarely our fault.1.
OnResizewas missing from the grid — now fixedThe event has always existed on
TfpgWidget, and the notification path fires correctly, including when a layout manager resizes a widget. It simply was never republished on the grid classes, so it was invisible to user code and to the designer. That was an oversight on our side.TfpgStringGridandTfpgFileGridnow publishOnResizein thedevelopbranch.2.
Widthin fpGUI is not what i…