[lazarus] How to scroll TMemo control in code
hernan.et at pg.com
hernan.et at pg.com
Sun Mar 30 18:38:30 EST 2003
Does this mean that I will use TMemoScrollBar or is TMemo a descendant of
I will try to check out latest cvs today and give it a try.
By the way, I managed to move the scrollbar in code last week end but I noticed
that as the contents of memo gets larger and larger, appending text becomes
slower. Part of the reason maybe because my code will scroll the TMemo to bottom
everytime I add the text. But looking at how TMemo inserts text, it is deleting
the entire contents and replace it with a new one (gtkObject.inc). It tried
figuring out how the content is updated but to no avail, I just dont really get
it. Can somebody please help me understand how the updated text is send to gtk
myMemo : TMemo;
procedure TfrmTest.Button1Click(Sender : TObject);
i : Integer;
for i := 0 to 1000 do
If I understand it right, we must just append "Hello Lazarus" to the current
text that is inside GtkText object. But as I said, looking at gtkobject.inc, we
delete the whole text and then insert. Which I believe is the cause of slow down
in appending many short text in TMemo.
Again, to make my self clear, can somebody help me understand how the lines
property of TMemo gets send to gtkObject.inc??????
Internet Mail Message
Received from host:
From: Mattias Gaertner <nc-gaertnma at netcologne.de> on 03/29/2003 05:34 PM GMT
Mattias Gaertner To: lazarus at miraclec.com
<nc-gaertnma at netcologne.de> Cc: (bcc: Yoyong Hernan-ET/PGI)
Subject: Re: [lazarus] How to scroll TMemo
control in code
03/30/2003 01:34 AM
Please respond to
lazarus at miraclec.com
On Sat, 29 Mar 2003 12:15:19 +0100
Marc Weustink <marc at dommelstein.net> wrote:
> At 10:45 29-3-2003 +0100, you wrote:
> >On 28 Mar 2003 11:07:59 -0500
> >andrew johnson <acjgenius at earthlink.net> wrote:
> > > I think this is a great idea. And FYI.. the only reasons
> > > TControlScrollBar is so inflexible is because, a) I didn't know what I
> > > was doing. and b) because I was only attempting to implement what was
> > > needed for TScrollingWinControl stuff. So, if it is possible to make
> > > as many of these changes as possible directly in TControlScrollBar
> > > without breaking TScrollingWinControl, and Delphi compatibility in
> > > that regard I think it would make more sense to do so.
> >I changed the FControl in TControlScrollbar into a TWincontrol. Most of
> >code only works if the FControl is a TScollingWinControl. For all other
> >it does nothing.
> >Now it's time for implementation.
> >The TMemoScrollBar should be mostly readonly, but the position property.
> >The TControlScrollbar is currently quite the opposite. It updates the
> >position due to messages and set all other values (min, max, page) and
> >even calculates the visibility itself.
> >Therefore TControlScrollbar should for non-TScrollWinControls only read
> >the values from the interface and raise an exception on writing the
> >properties. TMemoScrollbar should implement SetPosition.
> >TMemo must create/destroy the two TMemoScrollbar.
> >So, we need functions to read
> >Increment, Page, Min, Max, Range, Size, Position, Smooth
> >and a function to set the
> I don't see any harm in setting Increment, Page and Smooth as well (half
> page scrolling in stead of pagescrolling or so)
> >I think, we can simple use GetScrollInfo and SetScrollInfo.
> Think so.
I changed TControlScrollBar, added TMemoScrollBar and added two public
scrollbar properties to TCustomMemo. You can read Visible, Position, Range,
Page and Size and write Position and Page.
Only one new interface function was neccessary: GetScrollBarVisible, which
was missing in GetScrollInfo.
Increment and Smooth are also missing and are left as an exercise.
To unsubscribe: mail lazarus-request at miraclec.com with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
More information about the Lazarus