mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 13:39:33 +02:00
Make TFPMemo view srollable even if no scrollbars are attached to it
This commit is contained in:
parent
51055fa196
commit
24f498292a
packages/ide
@ -5012,6 +5012,7 @@ end;
|
||||
procedure TFPMemo.HandleEvent(var Event: TEvent);
|
||||
var DontClear: boolean;
|
||||
S: string;
|
||||
LineCount,LinesScroll : Sw_Integer;
|
||||
begin
|
||||
case Event.What of
|
||||
evKeyDown :
|
||||
@ -5028,6 +5029,22 @@ begin
|
||||
end;
|
||||
if not DontClear then ClearEvent(Event);
|
||||
end;
|
||||
evMouseDown:
|
||||
if (Event.Buttons=mbScrollUp) then { mouse scroll up}
|
||||
begin
|
||||
LinesScroll:=1;
|
||||
if Event.Double then LinesScroll:=LinesScroll+4;
|
||||
LineCount:=Max(GetLineCount,1);
|
||||
ScrollTo(Delta.X,Min(Max(0,LineCount-Size.Y),Delta.Y+LinesScroll));
|
||||
ClearEvent(Event);
|
||||
end else
|
||||
if (Event.Buttons=mbScrollDown) then { mouse scroll down }
|
||||
begin
|
||||
LinesScroll:=-1;
|
||||
if Event.Double then LinesScroll:=LinesScroll-4;
|
||||
ScrollTo(Delta.X, Max(0,Delta.Y+LinesScroll));
|
||||
ClearEvent(Event);
|
||||
end;
|
||||
end;
|
||||
inherited HandleEvent(Event);
|
||||
end;
|
||||
|
@ -3583,10 +3583,10 @@ end;
|
||||
|
||||
procedure TCustomCodeEditor.ScrollTo(X, Y: sw_Integer);
|
||||
begin
|
||||
inherited ScrollTo(X,Y);
|
||||
if (HScrollBar=nil) or (VScrollBar=nil) then
|
||||
begin Delta.X:=X; Delta.Y:=Y; end;
|
||||
DrawView;
|
||||
inherited ScrollTo(X,Y);
|
||||
if (HScrollBar=nil) then Delta.X:=Max(X,0);
|
||||
if (VScrollBar=nil) then Delta.Y:=Max(Min(Y,GetLineCount-1),0);
|
||||
if (HScrollBar=nil) or (VScrollBar=nil) then DrawView;
|
||||
end;
|
||||
|
||||
function TCustomCodeEditor.IsModal: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user