mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-11 12:10:43 +01:00
Make TFPMemo view srollable even if no scrollbars are attached to it
This commit is contained in:
parent
51055fa196
commit
24f498292a
@ -5012,6 +5012,7 @@ end;
|
|||||||
procedure TFPMemo.HandleEvent(var Event: TEvent);
|
procedure TFPMemo.HandleEvent(var Event: TEvent);
|
||||||
var DontClear: boolean;
|
var DontClear: boolean;
|
||||||
S: string;
|
S: string;
|
||||||
|
LineCount,LinesScroll : Sw_Integer;
|
||||||
begin
|
begin
|
||||||
case Event.What of
|
case Event.What of
|
||||||
evKeyDown :
|
evKeyDown :
|
||||||
@ -5028,6 +5029,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
if not DontClear then ClearEvent(Event);
|
if not DontClear then ClearEvent(Event);
|
||||||
end;
|
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;
|
end;
|
||||||
inherited HandleEvent(Event);
|
inherited HandleEvent(Event);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -3583,10 +3583,10 @@ end;
|
|||||||
|
|
||||||
procedure TCustomCodeEditor.ScrollTo(X, Y: sw_Integer);
|
procedure TCustomCodeEditor.ScrollTo(X, Y: sw_Integer);
|
||||||
begin
|
begin
|
||||||
inherited ScrollTo(X,Y);
|
inherited ScrollTo(X,Y);
|
||||||
if (HScrollBar=nil) or (VScrollBar=nil) then
|
if (HScrollBar=nil) then Delta.X:=Max(X,0);
|
||||||
begin Delta.X:=X; Delta.Y:=Y; end;
|
if (VScrollBar=nil) then Delta.Y:=Max(Min(Y,GetLineCount-1),0);
|
||||||
DrawView;
|
if (HScrollBar=nil) or (VScrollBar=nil) then DrawView;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomCodeEditor.IsModal: boolean;
|
function TCustomCodeEditor.IsModal: boolean;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user