Fixes setting the position of a form in wince

git-svn-id: trunk@15372 -
This commit is contained in:
sekelsenmat 2008-06-10 01:08:54 +00:00
parent c80ec36fb2
commit 7f7721db71
2 changed files with 26 additions and 6 deletions

View File

@ -415,9 +415,12 @@ begin
{$ENDIF}
suppressMove := false;
AdaptBounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight, suppressMove);
// Don't move forms, it doesn't work (yet), I don't know why
if not suppressMove and not (AWinControl is TCustomForm) then
MoveWindow(AWinControl.Handle, IntfLeft, IntfTop, IntfWidth, IntfHeight, true);
// Why would we want to supress the move?
// Form moving is indispensable to have message dialogs
MoveWindow(AWinControl.Handle, IntfLeft, IntfTop, IntfWidth, IntfHeight, true);
LCLControlSizeNeedsUpdate(AWinControl, false);
end;

View File

@ -371,6 +371,7 @@ class procedure TWinCEWSCustomForm.SetBounds(const AWinControl: TWinControl;
var
SizeRect: Windows.RECT;
BorderStyle: TFormBorderStyle;
WR: Windows.RECT;
begin
// the LCL defines the size of a form without border, win32 with.
// -> adjust size according to BorderStyle
@ -384,10 +385,26 @@ begin
BorderStyle := TCustomForm(AWinControl).BorderStyle;
Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags(
BorderStyle), false, BorderStyleToWin32FlagsEx(BorderStyle));
if (Application.ApplicationType in [atPDA, atSmartphone, atDefault]) then
begin
{ We should never move forms which are in full-screen mode }
if (BorderStyle <> bsDialog) and (BorderStyle <> bsNone) then Exit;
{ On normal dialogs we need to take into consideration the size of
the window decoration. }
if (BorderStyle = bsDialog) then
begin
Windows.SystemParametersInfo(SPI_GETWORKAREA, 0, @WR, 0);
SizeRect.Top := WR.Top;
SizeRect.Left := WR.Left;
end;
{ On borderless Windows we allow the user full control of the window position }
end;
// rect adjusted, pass to inherited to do real work
TWinCEWSWinControl.SetBounds(AWinControl, ALeft, ATop, SizeRect.Right - SizeRect.Left,
SizeRect.Bottom - SizeRect.Top);
TWinCEWSWinControl.SetBounds(AWinControl, SizeRect.Left, SizeRect.Top,
SizeRect.Right - SizeRect.Left, SizeRect.Bottom - SizeRect.Top);
end;
class procedure TWinCEWSCustomForm.SetIcon(const AForm: TCustomForm; const AIcon: HICON);