Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Expose sbVert TScrollBar object

 Post Reply Post Reply
Author
Zimmelman Steve View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2012
Posts: 8
Post Options Post Options   Quote Zimmelman Steve Quote  Post ReplyReply Direct Link To This Post Topic: Expose sbVert TScrollBar object
    Posted: 15 Dec 2012 at 5:12pm
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-
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7918
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 16 Dec 2012 at 4:02am
Thanks for this good suggestion. We can confirm the next update of TAdvMemo will have this behavior directly built-in.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down