Solved

Scrolling TRichEdit

Posted on 2000-03-02
6
245 Views
Last Modified: 2010-04-04
How can I make the TRichEdit scroll along with the text when I automatically add lines to it:

  RichEdit.Lines.Add('Blah');

??
0
Comment
Question by:nrico
6 Comments
 
LVL 7

Expert Comment

by:RBertora
ID: 2576096
Richedit.Setfocus;

then each time you add, use:

SendMessage(RichEdit.Handle,WM_KeyDown,40,0);

Rob;-)
0
 
LVL 1

Author Comment

by:nrico
ID: 2576449
Wait, I forgot to tell the lines are added from a TEdit control, but I want the Edit to keep focus (It's for a chat program -- My friends wanted colors in it :-). So I'd have to keep switching focus, right?
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2576574
No you wouldn't have to change focus all the time. infact you don't have to use setfocus at all.

Rob;-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Accepted Solution

by:
edey earned 75 total points
ID: 2576766
or you could try this :)


EM_SCROLLCARET

wParam = 0 ;    // not used now; reserved for future use; must be zero
lParam = 0 ;    // not used now; reserved for future use;  must be zero
 

An application sends an EM_SCROLLCARET message to scroll the caret into view in an edit control.




GL
Mike
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2577500
hi,

another way (sample)

you can use this to scroll one line

//Scroll Up
procedure TForm1.Button1Click(Sender: TObject);
begin
  richedit1.Perform(EM_SCROLL,SB_LINEUP,0);
end;

//Scroll Down
procedure TForm1.Button2Click(Sender: TObject);
begin
  richedit1.Perform(EM_SCROLL,SB_LINEDOWN,0);
end;

meikl
0
 
LVL 6

Expert Comment

by:edey
ID: 2602988
Thank you, glad to be of service :)


GL
Mike
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now