diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-18 17:05:58 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-18 17:05:58 +0200 |
commit | 702e6fd3f55a4eb55316c0892cf21bc80436b8b6 (patch) | |
tree | bf64bf35fee297c5615e79f428c4c6619c6d50ff | |
parent | 1e916603e6b783c25c58b08c2165497b103ccf80 (diff) | |
download | fpGUI-702e6fd3f55a4eb55316c0892cf21bc80436b8b6.tar.xz |
TfpgWidget.SetAlign called the wrong ReAlign() method.
Not calling Parent.Realign ment we (self widget) is not being
resized (excluded from the re-align calculation), and thus the
self widget status at its current location and dimentions - until
the end-user actually resizes the top-level form.
This has now been fixed.
NOTE:
If you create extra widgets (eg: frames) outside the control of
the UI Designer, but still created before resource handles are
created, and you use Align property in those widgets, you need to
rather create those in Form.OnShow().
Align changes are not always acted apon before they have a window
handle, so it's best to do it in Form.OnShow for example. I'm still
figuring out how best to handle this.
-rw-r--r-- | src/corelib/fpg_widget.pas | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 67dc0eec..deb9b058 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -316,7 +316,8 @@ begin if FAlign = AValue then Exit; FAlign := AValue; - Realign; + if Parent <> nil then + Parent.Realign; end; procedure TfpgWidget.SetVisible(const AValue: boolean); @@ -1282,7 +1283,7 @@ begin alist.Free; end; - // handle anchors finally for alNone + // Finally handle anchors (where Align = alNone) for n := 0 to ComponentCount - 1 do if (Components[n] is TfpgWidget) then begin @@ -1326,7 +1327,7 @@ begin itf := DebugMethodEnter('TfpgWidget.MoveAndResize'); DebugLn(Format('Class:%s t:%d l:%d w:%d h:%d', [Classname, ATop, ALeft, AWidth, aHeight])); {$ENDIF} - if HasHandle then + if not (csLoading in ComponentState) {HasHandle} then begin if (ALeft <> FLeft) or (ATop <> FTop) then HandleMove(ALeft, ATop); |