944,099 Members | Top Members by Rank

Ad:
Sep 29th, 2009
-1

RichEdit and Autoscroll

Expand Post »
Hello everyone...

I'm having a problem with RichEdit and its default scrolling behaviour.

When a new line is added to a RichEdit (via a Timer OnTimer event), it autoscrolls to the bottom, which is fine. The problem is, while it scrolls to bottom, it also resets the horizontal scrollbar to the left, which is undesirable because I want to view the end of my messages.

I've tried to detect SB_LEFT, SB_LINELEFT... messages but it seems RichEdit's control doesn't send these messages but instead just uses SetScrollBarInfo() or something like that to move the horizontal scroll bar whenever the user wants to scroll to the vertical scrollbar to bottom.

Therefore I've tried to implement my own routine to catch SB_BOTTOM messages to avoid resetting the horizontal bar:


if Message.ScrollCode = SB_BOTTOM
begin
GetScrollInfo();..
yPos:= si.nPos;
si.nPos:= si.nMax;
...
SetScrollInfo();..

ScrollWindowEX(handle, 0, yChar * (yPos - si.nPos),...);
UpdateWindow(handle);
end;

just like the example in MSDN. However, while the scrollbars look like they're working properly, the actual content isn't scrolled up.

I'd like to know the reason for this and I don't think it's necessary to write my own WMPAINT function.

I don't want to use EM_LINESCROLL, SB_LINEDOWN messages either since they will give the same behaviour (i.e. resetting the horizontal scrollbar).

Does anyone know how I can fix my SB_BOTTOM routine so that the actual text is scrolled?? Thank you.
Last edited by lapassion; Sep 29th, 2009 at 11:16 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lapassion is offline Offline
2 posts
since Sep 2009
Oct 8th, 2009
0
Re: RichEdit and Autoscroll
Help!!!! Anyone???
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lapassion is offline Offline
2 posts
since Sep 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: Ordinal types
Next Thread in Pascal and Delphi Forum Timeline: DBISAM Question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC