mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 09:40:27 +02:00
LCL: Make TUpDown.ArrowKeys work. Issue #28537, patch from Denis Kozlov.
git-svn-id: trunk@49726 -
This commit is contained in:
parent
83d51bb80f
commit
fdde7f3583
@ -1370,6 +1370,8 @@ type
|
||||
procedure RemoveHandler(HandlerType: TControlHandlerType;
|
||||
const AMethod: TMethod);
|
||||
procedure DoCallNotifyHandler(HandlerType: TControlHandlerType);
|
||||
procedure DoCallKeyEventHandler(HandlerType: TControlHandlerType;
|
||||
var Key: Word; Shift: TShiftState);
|
||||
procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); virtual;
|
||||
procedure SetZOrder(TopMost: Boolean); virtual;
|
||||
class function GetControlClassDefaultSize: TSize; virtual;
|
||||
|
@ -1843,6 +1843,16 @@ begin
|
||||
FControlHandlers[HandlerType].CallNotifyEvents(Self);
|
||||
end;
|
||||
|
||||
procedure TControl.DoCallKeyEventHandler(HandlerType: TControlHandlerType;
|
||||
var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := FControlHandlers[HandlerType].Count;
|
||||
while FControlHandlers[HandlerType].NextDownIndex(i) do
|
||||
TKeyEvent(FControlHandlers[HandlerType][i])(Self, Key, Shift);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TControl.DoContextPopup(const MousePos: TPoint;
|
||||
var Handled: Boolean);
|
||||
|
@ -355,25 +355,31 @@ end;
|
||||
|
||||
procedure TCustomUpDown.AssociateKeyDown(Sender: TObject; var Key: Word;
|
||||
ShiftState : TShiftState);
|
||||
var
|
||||
ConsumeKey: Boolean;
|
||||
begin
|
||||
If ArrowKeys and (ShiftState = []) then begin
|
||||
ConsumeKey := False;
|
||||
if ArrowKeys and (ShiftState = []) then
|
||||
begin
|
||||
case FOrientation of
|
||||
udVertical:
|
||||
case Key of
|
||||
VK_Up:
|
||||
TCustomSpeedButton(FMaxBtn).Click;
|
||||
begin TCustomSpeedButton(FMaxBtn).Click; ConsumeKey := True; end;
|
||||
VK_Down:
|
||||
TCustomSpeedButton(FMinBtn).Click;
|
||||
begin TCustomSpeedButton(FMinBtn).Click; ConsumeKey := True; end;
|
||||
end;
|
||||
udHorizontal:
|
||||
case Key of
|
||||
VK_Left:
|
||||
TCustomSpeedButton(FMinBtn).Click;
|
||||
begin TCustomSpeedButton(FMinBtn).Click; ConsumeKey := True; end;
|
||||
VK_Right:
|
||||
TCustomSpeedButton(FMaxBtn).Click;
|
||||
begin TCustomSpeedButton(FMaxBtn).Click; ConsumeKey := True; end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
end;
|
||||
if ConsumeKey then
|
||||
Key := 0;
|
||||
end;
|
||||
|
||||
procedure TCustomUpDown.OnAssociateChangeBounds(Sender: TObject);
|
||||
|
@ -5631,6 +5631,7 @@ end;
|
||||
procedure TWinControl.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
if Assigned(FOnKeyDown) then FOnKeyDown(Self, Key, Shift);
|
||||
DoCallKeyEventHandler(chtOnKeyDown, Key, Shift);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user