Fixes spin control SetBounds in wince

git-svn-id: trunk@21338 -
This commit is contained in:
sekelsenmat 2009-08-19 22:05:40 +00:00
parent f63f57fda7
commit f2011b86d1
3 changed files with 24 additions and 8 deletions

View File

@ -1697,15 +1697,29 @@ var
WindowInfo: PWindowInfo;
Style, ExStyle: longint;
{ procedure AdjustForBuddySize;
procedure AdjustForBuddySize;
{$IFDEF WinCE}
var
BuddyHandle: HWND;
BuddyWP: WINDOWPLACEMENT;
BuddyR: TRect;
begin
BuddyHandle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0);
if (BuddyHandle<>HWND(nil)) then
if Windows.GetWindowRect(BuddyHandle, BuddyR) then
Width := BuddyR.Right - BuddyR.Left;
end;
{$ELSE}
var
BuddyHandle: HWND;
BuddyWP, WP: WINDOWPLACEMENT;
begin
WP.length := SizeOf(WP);
Windows.GetWindowPlacement(Handle, WP);
BuddyHandle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0);
if (BuddyHandle<>HWND(nil)) and Windows.GetWindowPlacement(BuddyHandle, BuddyWP)
then Width := WP.rcNormalPosition.Right - BuddyWP.rcNormalPosition.Left;
end;}
end;
{$ENDIF}
begin
Result := Boolean(Windows.GetWindowRect(Handle, R));
@ -1760,8 +1774,8 @@ begin
else
Dec(Height, Windows.GetSystemMetrics(SM_CYCAPTION));
// if (WindowInfo^.WinControl is TCustomFloatSpinEdit) then
// AdjustForBuddySize;
if (WindowInfo^.WinControl is TCustomFloatSpinEdit) then
AdjustForBuddySize;
end;
{

View File

@ -409,7 +409,9 @@ begin
{$ENDIF}
suppressMove := false;
AdaptBounds(AWinControl, IntfLeft, IntfTop, IntfWidth, IntfHeight, suppressMove);
MoveWindow(AWinControl.Handle, IntfLeft, IntfTop, IntfWidth, IntfHeight, true);
// Some controls, like spins, may set suppressMove in AdaptBounds
if not suppressMove then
MoveWindow(AWinControl.Handle, IntfLeft, IntfTop, IntfWidth, IntfHeight, true);
LCLControlSizeNeedsUpdate(AWinControl, false);
end;

View File

@ -187,7 +187,7 @@ begin
// Felipe: With this code, the edit part gets invisible
// Is the same as win32 code, need to check why
{ WinHandle := AWinControl.Handle;
WinHandle := AWinControl.Handle;
BuddyHandle := Windows.SendMessage(WinHandle, UDM_GETBUDDY, 0, 0);
GetWindowRect(WinHandle, @R);
@ -196,7 +196,7 @@ begin
MoveWindow(BuddyHandle, Left, Top, Width - WindowWidth + 2, Height, True);
MoveWindow(WinHandle, Left + Width - WindowWidth, Top, WindowWidth, Height, True);
SuppressMove := True;}
SuppressMove := True;
end;
class function TWinCEWSCustomFloatSpinEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;