summaryrefslogtreecommitdiff
path: root/src/corelib/gdi
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2011-01-10 23:44:33 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-01-11 09:45:29 +0200
commit9a622052b07b1605fe4cf4465404df11f0fd12da (patch)
tree91c246ed6dcebeab0ed90d3576af08f97042409e /src/corelib/gdi
parent912541f487ef8356352a452c005097623df0cf00 (diff)
downloadfpGUI-9a622052b07b1605fe4cf4465404df11f0fd12da.tar.xz
fixes Alignment and Anchor calculation even before we have a window handle
Updated the following methods by rather checking the ComponentState, than the HasHandle result. Why? Because we want alignment and anchor calculations to work, even before we have a window handle. Something that happens often when using a Frame-type design for the UI. * HandleMove() * HandleResize() * UpdateWindowPosition() Due to removing the HasHandle check in UpdateWindowPosition, we had to do the HasHandle check in each backend code instead. We don't want to trigger API calls when we don't have a window handle yet.
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r--src/corelib/gdi/fpg_gdi.pas19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index 6d1ff0c7..9eb9f952 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -1976,14 +1976,17 @@ procedure TfpgGDIWindow.DoUpdateWindowPosition;
var
bx, by: integer;
begin
- FSkipResizeMessage := True;
- GetWindowBorderDimensions(Self, bx, by);
- Windows.SetWindowPos(
- WinHandle, HWND_TOP,
- FLeft, FTop, FWidth + bx, FHeight + by,
- SWP_NOZORDER);// or SWP_NOREDRAW);
- Windows.InvalidateRect(WinHandle, nil, True);
- FSkipResizeMessage := False;
+ if HasHandle then
+ begin
+ FSkipResizeMessage := True;
+ GetWindowBorderDimensions(Self, bx, by);
+ Windows.SetWindowPos(
+ WinHandle, HWND_TOP,
+ FLeft, FTop, FWidth + bx, FHeight + by,
+ SWP_NOZORDER);// or SWP_NOREDRAW);
+ Windows.InvalidateRect(WinHandle, nil, True);
+ FSkipResizeMessage := False;
+ end;
end;
{ TfpgGDICanvas }