RichEdit and Autoscroll

Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Sep 2009
Posts: 2
Reputation: lapassion is an unknown quantity at this point 
Solved Threads: 0
lapassion lapassion is offline Offline
Newbie Poster

RichEdit and Autoscroll

 
-1
  #1
Sep 29th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 2
Reputation: lapassion is an unknown quantity at this point 
Solved Threads: 0
lapassion lapassion is offline Offline
Newbie Poster
 
0
  #2
Oct 8th, 2009
Help!!!! Anyone???
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum


Views: 720 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Pascal and Delphi
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC