FV In ListBox mouse scroll function as Key Up or Key Down

This commit is contained in:
Margers 2024-09-24 11:17:26 +00:00 committed by Michael Van Canneyt
parent 818e3ae6e5
commit e1cb188157
5 changed files with 25 additions and 11 deletions

View File

@ -3577,7 +3577,8 @@ END;
{---------------------------------------------------------------------------}
PROCEDURE THistoryViewer.HandleEvent (Var Event: TEvent);
BEGIN
If ((Event.What = evMouseDown) AND (Event.Double)) { Double click mouse }
If ((Event.What = evMouseDown) AND (Event.Double) { Double click mouse }
and ((Event.Buttons and (mbScrollUp or mbScrollDown))=0)){and not scroll}
OR ((Event.What = evKeyDown) AND
(Event.KeyCode = kbEnter)) Then Begin { Enter key press }
EndModal(cmOk); { End with cmOk }

View File

@ -1022,7 +1022,8 @@ var
K : pointer;
Value : Sw_integer;
begin
if (Event.What = evMouseDown) and (Event.Double) then
if (Event.What = evMouseDown) and (Event.Double) { double click and not scroll}
and ((Event.Buttons and (mbScrollUp or mbScrollDown))=0) then
begin
Event.What := evCommand;
Event.Command := cmOK;
@ -1823,7 +1824,7 @@ procedure TDirListBox.HandleEvent(var Event: TEvent);
begin
case Event.What of
evMouseDown:
if Event.Double then
if Event.Double and ((Event.Buttons and (mbScrollUp or mbScrollDown))=0) then
begin
Event.What := evCommand;
Event.Command := cmChangeDir;

View File

@ -3824,6 +3824,15 @@ BEGIN
End;
End;
evMouseDown: Begin { Mouse down event }
if (Event.Buttons=mbScrollUp) then { mouse scroll up}
begin
if Event.Double then MoveFocus(Focused+1) else MoveFocus(Focused+1);
end else
if (Event.Buttons=mbScrollDown) then { mouse scroll down }
begin
if Event.Double then MoveFocus(Focused-1) else MoveFocus(Focused-1);
end else
begin
Cw := Size.X DIV NumCols + 1; { Column width }
Oi := Focused; { Hold focused item }
MakeLocal(Event.Where, Mouse); { Localize mouse }
@ -3864,6 +3873,7 @@ BEGIN
If (Oi <> Ni) Then MoveFocus(Ni); { Focus moved again }
If (Event.Double AND (Range > Focused)) Then
SelectItem(Focused); { Select the item }
end;
ClearEvent(Event); { Event was handled }
End;
End;

View File

@ -2533,7 +2533,7 @@ begin
ST^.GrowMode:=gfGrowHiX;
Insert(ST);
GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,1); R.B.Y:=R.A.Y+1;
New(ST, Init(R, CharStr('Ä', MaxViewWidth)));
New(ST, Init(R, CharStr(''#$C4'', MaxViewWidth)));
ST^.GrowMode:=gfGrowHiX;
Insert(ST);
GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,2);Dec(R.B.Y,5);
@ -3252,12 +3252,12 @@ procedure TWatchesListBox.HandleEvent(var Event: TEvent);
var DontClear: boolean;
begin
case Event.What of
evMouseDown : begin
if Event.Double then
Message(@Self,evCommand,cmEdit,nil)
else
ClearEvent(Event);
end;
evMouseDown :
if Event.Double and ((Event.Buttons and (mbScrollUp or mbScrollDown))=0) {not scroll} then
begin
Message(@Self,evCommand,cmEdit,nil);
ClearEvent(Event);
end;
evKeyDown :
begin
DontClear:=false;

View File

@ -1211,13 +1211,15 @@ begin
end;
procedure TAdvancedListBox.HandleEvent(var Event: TEvent);
var eEvent : TEvent;
begin
case Event.What of
evMouseDown :
if MouseInView(Event.Where) {and (Event.Double)} then
begin
eEvent:=Event; {save for later use after inherited call}
inherited HandleEvent(Event);
if Event.Double then
if (eEvent.Double) and ((eEvent.Buttons and (mbScrollUp or mbScrollDown))=0) then
if Range>Focused then
SelectItem(Focused);
end;