mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 21:59:15 +02:00
win32: better spin edit (spin placed inside edit)
git-svn-id: trunk@51971 -
This commit is contained in:
parent
ae57408e17
commit
4642421795
@ -2221,7 +2221,7 @@ var
|
||||
begin
|
||||
UpDownWP.length := SizeOf(UpDownWP);
|
||||
if Windows.GetWindowPlacement(WindowInfo^.UpDown, UpDownWP) then
|
||||
Width := UpDownWP.rcNormalPosition.Right - WP.rcNormalPosition.Left;
|
||||
Width := Max(Width, UpDownWP.rcNormalPosition.Right - WP.rcNormalPosition.Left);
|
||||
end;
|
||||
|
||||
procedure ExcludeCaption; inline;
|
||||
|
@ -29,7 +29,7 @@ uses
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
CommCtrl, Windows, Win32Extra,
|
||||
Spin, Controls, StdCtrls, LCLType, LMessages, LazUTF8,
|
||||
Spin, Controls, StdCtrls, LCLType, LMessages, Themes, LazUTF8,
|
||||
////////////////////////////////////////////////////
|
||||
WSSpin, WSLCLClasses, WSProc,
|
||||
Win32Int, Win32Proc, Win32WSStdCtrls, Win32WSControls;
|
||||
@ -163,8 +163,11 @@ begin
|
||||
Flags := Flags or ES_AUTOHSCROLL;
|
||||
HotTracking := False;
|
||||
SystemParametersInfo(SPI_GETHOTTRACKING, 0, @HotTracking, 0);
|
||||
UpDownFlags := WS_CHILD or WS_CLIPSIBLINGS or UDS_ALIGNRIGHT or UDS_ARROWKEYS or
|
||||
UpDownHotStyle[HotTracking] or ((WS_VISIBLE or WS_DISABLED) and Flags);
|
||||
|
||||
UpDownFlags := WS_CHILD or WS_CLIPSIBLINGS or UDS_ARROWKEYS
|
||||
or UpDownHotStyle[HotTracking]
|
||||
or ((WS_VISIBLE or WS_DISABLED) and Flags);
|
||||
|
||||
Window := CreateWindowExW(FlagsEx, PWideChar(WideString(EditClsName)),
|
||||
PWideChar(UTF8ToUTF16(StrCaption)), Flags,
|
||||
Left, Top, Width, Height, Parent, HMENU(nil), HInstance, nil);
|
||||
@ -260,7 +263,7 @@ class procedure TWin32WSCustomFloatSpinEdit.AdaptBounds(const AWinControl: TWinC
|
||||
var
|
||||
WinHandle, UpDown: HWND;
|
||||
R: TRect;
|
||||
UpDownWidth: Integer;
|
||||
UpDownWidth, BorderWidth: Integer;
|
||||
DWP: HDWP;
|
||||
begin
|
||||
WinHandle := AWinControl.Handle;
|
||||
@ -275,11 +278,16 @@ begin
|
||||
}
|
||||
GetWindowRect(UpDown, @R);
|
||||
UpDownWidth := R.Right - R.Left;
|
||||
if (WindowsVersion >= wvXP) and ThemeServices.ThemesEnabled then
|
||||
BorderWidth := GetSystemMetrics(SM_CXBORDER)
|
||||
else
|
||||
BorderWidth := GetSystemMetrics(SM_CXEDGE);
|
||||
|
||||
DWP := BeginDeferWindowPos(2);
|
||||
DeferWindowPos(DWP, WinHandle, UpDown, Left, Top, Width - UpDownWidth + 2, Height, SWP_NOACTIVATE);
|
||||
DeferWindowPos(DWP, UpDown, 0, Left + Width - UpDownWidth, Top, UpDownWidth, Height, SWP_NOZORDER or SWP_NOACTIVATE);
|
||||
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);
|
||||
SendMessage(WinHandle, EM_SETMARGINS, EC_RIGHTMARGIN, MAKELONG(0, UpDownWidth + BorderWidth + 1));
|
||||
|
||||
SuppressMove := True;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user