Skip to content

Commit eba43d4

Browse files
Rico-Rodriguezollydev
authored andcommitted
Add DoMouseWheel method for horizontal scrolling
Implement mouse wheel scrolling functionality for horizontal scrollbar.
1 parent c1feffb commit eba43d4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Source/ide/simba.form_output.pas

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ TSimbaOutputBox = class(TSimbaMemo)
4242
procedure DoAllowMouseLink(Sender: TObject; X, Y: Integer; var AllowMouseLink: Boolean);
4343
procedure DoMouseLinkClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
4444

45+
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
46+
4547
function GetTabTitle: String;
4648
function GetTabImageIndex: Integer;
4749
procedure SetTabTitle(Value: String);
@@ -274,6 +276,22 @@ procedure TSimbaOutputBox.DoMouseLinkClick(Sender: TObject; Button: TMouseButton
274276
Application.QueueAsyncCall(@DoOpenLink, 0);
275277
end;
276278

279+
function TSimbaOutputBox.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean;
280+
const
281+
SCROLL_AMOUNT = 5;
282+
begin
283+
if (ssShift in Shift) then
284+
begin
285+
if (WheelDelta > 0) then
286+
FScrollbarHorz.Position := FScrollbarHorz.Position - SCROLL_AMOUNT
287+
else
288+
FScrollbarHorz.Position := FScrollbarHorz.Position + SCROLL_AMOUNT;
289+
290+
Result := True;
291+
end else
292+
Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos);
293+
end;
294+
277295
constructor TSimbaOutputBox.Create(AOwner: TComponent);
278296
begin
279297
inherited Create(AOwner, False);

0 commit comments

Comments
 (0)