diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-12-30 15:53:13 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-12-30 15:53:13 +0200 |
commit | 2a9dc8ebacf5ec0177299c371746b649c105341e (patch) | |
tree | dc3c2823b9bfa9322c4f1dffe8693a2ed458c724 /src/corelib | |
parent | a8321078f063f5bff77721d1df691de68ceba50e (diff) | |
download | fpGUI-2a9dc8ebacf5ec0177299c371746b649c105341e.tar.xz |
TfpgWidget.MsgResize never considered constraints when calculating size deltas
Old behaviour calculated the size deltas, then applied the new sizes from
the received message. The new sizes were not guaranteed due to widget size
constraints that could be applied, which means the deltas could be wrong, which
in turn meant child components could be positioned incorrectly.
We now store the original size values in temp variables, apply the new sizes
which handles possible constraints, then only do we calculate the deltas, and
then pass those on to HandleAlignments().
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpg_widget.pas | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index deb9b058..e13806be 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -1203,6 +1203,7 @@ procedure TfpgWidget.MsgResize(var msg: TfpgMessageRec); var dw: integer; dh: integer; + _w, _h: integer; {$IFDEF CStackDebug} itf: IInterface; {$ENDIF} @@ -1210,9 +1211,15 @@ begin {$IFDEF CStackDebug} itf := DebugMethodEnter('TfpgWidget.MsgResize - ' + ClassName + ' ('+Name+')'); {$ENDIF} - dw := msg.Params.rect.Width - FWidth; - dh := msg.Params.rect.Height - FHeight; + _w := FWidth; + _h := FHeight; + { Width and Height might not be what came through in the msg because of + size constraints, so we calculate the delta diffs after HandleResize } HandleResize(msg.Params.rect.Width, msg.Params.rect.Height); + //dw := msg.Params.rect.Width - FWidth; + //dh := msg.Params.rect.Height - FHeight; + dw := FWidth - _w; + dh := FHeight - _h; HandleAlignments(dw, dh); if InDesigner then begin |