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