I am emulating Delphi's editor, and in order to vertically scroll using Ctrl+ArrowUp and Ctrl+ArrowDn, I have exposed a few properties. I realize this is not true oop, but unless I am missing something, I don't have a choice.
In order to access some protected properties/methods I use this in a locally scoped section of the unit:
TInternalAdvMemo = Class(TAdvMemo)
Public
End;
Then in the On Key Down method of they key trap:
If (ssCtrl In Shift) And (Key = VK_DOWN) Then Begin
i := FAdvMemo.TopLine+1 ;
TInternalAdvMemo(FAdvMemo).ScrollBarScroll(TInternalAdvMemo(FAdvMemo).sbVert,scLineDown,i);
End Else If (ssCtrl In Shift) And (Key = VK_UP) Then Begin
i := FAdvMemo.TopLine - 1 ;
TInternalAdvMemo(FAdvMemo).ScrollBarScroll(TInternalAdvMemo(FAdvMemo).sbVert,scLineUp,i);
End
I also moved
sbVert, sbHorz: TScrollBar;
from line 1212 in AdvMemo.pas (Private section) to line 1497 (Protected section).
If your next release could make these things a little easier to access, that would be helpful.
Regards,
-Steve-
Thanks for this good suggestion. We can confirm the next update of TAdvMemo will have this behavior directly built-in.