Commit 5361d2be authored by Michael W. Vogel's avatar Michael W. Vogel
Browse files

LCL: SpinEdit: Win32: Fixed z-order problem. Issue #27862

git-svn-id: trunk@54627 -
parent 63b04ac2
......@@ -223,9 +223,9 @@ begin
PWideChar(UTF8ToUTF16(StrCaption)), Flags,
Left, Top, Width, Height, Parent, HMENU(nil), HInstance, nil);
UpDown := CreateWindowExW(0, UPDOWN_CLASSW, nil, UpDownFlags,
0, 0, 8, Height, Parent, HMENU(nil), HInstance, nil);
0, 0, 8, Height, Window, HMENU(nil), HInstance, nil);
Windows.SendMessage(UpDown, UDM_SETBUDDY, WPARAM(Window), 0);
// Windows.SendMessage(UpDown, UDM_SETBUDDY, WPARAM(Window), 0);
end;
// create window
FinishCreateWindow(AWinControl, Params, True);
......@@ -315,18 +315,11 @@ class procedure TWin32WSCustomFloatSpinEdit.AdaptBounds(const AWinControl: TWinC
var
WinHandle, UpDown: HWND;
UpDownWidth, BorderWidth: Integer;
DWP: HDWP;
AClientRect: Windows.Rect;
begin
WinHandle := AWinControl.Handle;
UpDown := GetWin32WindowInfo(WinHandle)^.UpDown;
{
// detach from buddy first
Windows.SendMessage(UpDown, UDM_SETBUDDY, 0, 0);
MoveWindow(WinHandle, Left, Top, Width, Height, True);
// reattach
Windows.SendMessage(UpDown, UDM_SETBUDDY, WParam(WinHandle), 0);
}
UpDownWidth := GetUpDownWidth(AWinControl);
if (AWinControl as TCustomFloatSpinEdit).BorderStyle = bsNone then
BorderWidth := 0
......@@ -335,10 +328,17 @@ begin
else
BorderWidth := GetSystemMetrics(SM_CXEDGE);
DWP := BeginDeferWindowPos(2);
DeferWindowPos(DWP, WinHandle, UpDown, Left, Top, Width, Height, SWP_NOACTIVATE);
DeferWindowPos(DWP, UpDown, 0, Left + Width - UpDownWidth-BorderWidth, Top+BorderWidth, UpDownWidth, Height-BorderWidth*2, SWP_NOZORDER or SWP_NOACTIVATE);
EndDeferWindowPos(DWP);
SetWindowPos(WinHandle, UpDown, Left, Top, Width, Height, SWP_NOACTIVATE or SWP_NOZORDER);
if not Windows.GetClientRect(WinHandle, @AClientRect) then
begin
AClientRect.Left := 0;
AClientRect.Top := 0;
AClientRect.Right := Width - BorderWidth * 2;
AClientRect.Bottom := Height - BorderWidth * 2;
end;
SetWindowPos(UpDown, HWND_TOP,
AClientRect.Right - UpDownWidth, AClientRect.Top, UpDownWidth, AClientRect.Bottom,
SWP_NOACTIVATE or SWP_NOZORDER);
SuppressMove := True;
end;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment