mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 07:30:22 +02:00
win32: remove HandleSpinEditDeltaPos from generic WindowProc to default window proc of spinedit
git-svn-id: trunk@23623 -
This commit is contained in:
parent
7b408cd87b
commit
46bb53cc00
@ -860,26 +860,6 @@ var
|
||||
Result := WindowInfo^.isComboEdit and (ComboBoxHandleSizeWindow = Windows.GetParent(Window));
|
||||
end;
|
||||
|
||||
procedure HandleSpinEditDeltaPos(AUpDownMsg: PNMUpDown);
|
||||
var
|
||||
SpinEdit: TCustomFloatSpinEdit;
|
||||
spinHandle: HWND;
|
||||
newValue: Double;
|
||||
begin
|
||||
SpinEdit := TCustomFloatSpinEdit(WindowInfo^.WinControl);
|
||||
|
||||
if not SpinEdit.ReadOnly then
|
||||
begin
|
||||
NewValue := SpinEdit.GetLimitedValue(
|
||||
WindowInfo^.spinValue + AUpDownMsg^.iDelta * SpinEdit.Increment);
|
||||
WindowInfo^.spinValue := NewValue;
|
||||
|
||||
spinHandle := AUpDownMsg^.hdr.hwndFrom;
|
||||
UpdateFloatSpinEditText(SpinEdit, NewValue);
|
||||
Windows.SendMessage(spinHandle, UDM_SETPOS32, 0, 500);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetMinMaxInfo(var MinMaxInfo: TMINMAXINFO);
|
||||
procedure SetWin32SizePoint(AWidth, AHeight: integer; var pt: TPoint);
|
||||
var
|
||||
@ -2058,11 +2038,6 @@ begin
|
||||
if WindowInfo^.WinControl <> nil then
|
||||
lWinControl := WindowInfo^.WinControl;
|
||||
end;
|
||||
UDN_DELTAPOS:
|
||||
begin
|
||||
if WindowInfo^.WinControl <> nil then
|
||||
HandleSpinEditDeltaPos(PNMUpDown(LParam));
|
||||
end;
|
||||
NM_CLICK, NM_RCLICK:
|
||||
begin
|
||||
// A listview doesn't get a WM_LBUTTONUP, WM_RBUTTONUP message,
|
||||
|
@ -204,21 +204,44 @@ end;
|
||||
class procedure TWin32WSCustomFloatSpinEdit.DefaultWndHandler(const AWinControl: TWinControl; var AMessage);
|
||||
var
|
||||
lWindowInfo: PWin32WindowInfo;
|
||||
Message: TLMessage absolute AMessage;
|
||||
NewValue: Double;
|
||||
SpinEdit: TCustomFloatSpinEdit;
|
||||
UpDownMsg: PNMUPDOWN;
|
||||
begin
|
||||
case TLMessage(AMessage).Msg of
|
||||
case Message.Msg of
|
||||
CN_COMMAND:
|
||||
begin
|
||||
if HIWORD(TLMessage(AMessage).WParam) = EN_CHANGE then
|
||||
if HIWORD(Message.WParam) = EN_CHANGE then
|
||||
begin
|
||||
lWindowInfo := GetWin32WindowInfo(AWinControl.Handle);
|
||||
if lWindowInfo <> @DefaultWindowInfo then
|
||||
begin
|
||||
lWindowInfo^.spinValue := TSpinEdit(lWindowInfo^.WinControl).StrToValue(TSpinEdit(lWindowInfo^.WinControl).Text);
|
||||
SpinEdit := TCustomFloatSpinEdit(lWindowInfo^.WinControl);
|
||||
lWindowInfo^.spinValue := SpinEdit.StrToValue(SpinEdit.Text);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
CN_NOTIFY:
|
||||
begin
|
||||
if PNMHdr(Message.LParam)^.code = UDN_DELTAPOS then
|
||||
begin
|
||||
UpDownMsg := PNMUPDOWN(Message.LParam);
|
||||
lWindowInfo := GetWin32WindowInfo(UpDownMsg^.hdr.hwndFrom);
|
||||
SpinEdit := TCustomFloatSpinEdit(lWindowInfo^.WinControl);
|
||||
if not SpinEdit.ReadOnly then
|
||||
begin
|
||||
NewValue := SpinEdit.GetLimitedValue(
|
||||
lWindowInfo^.spinValue + UpDownMsg^.iDelta * SpinEdit.Increment);
|
||||
lWindowInfo^.spinValue := NewValue;
|
||||
|
||||
UpdateFloatSpinEditText(SpinEdit, NewValue);
|
||||
Windows.SendMessage(UpDownMsg^.hdr.hwndFrom, UDM_SETPOS32, 0, 500);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
inherited DefaultWndHandler(AWinControl,AMessage);
|
||||
inherited DefaultWndHandler(AWinControl, AMessage);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomFloatSpinEdit.GetPreferredSize(
|
||||
|
Loading…
Reference in New Issue
Block a user