?
Solved

Scrolling TRichEdit and TListBox

Posted on 1998-08-09
3
Medium Priority
?
285 Views
Last Modified: 2010-04-04
I want to scroll RichEdit and TListBox components automaticly to the bottom when something is added..
How do I do that?
0
Comment
Question by:mortenmo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
erajoj earned 200 total points
ID: 1361755
Hi,
Here is an example of one way to solve it:

var
  MyString: string;
begin
  MyString := 'Whatever';
  ListBox1.ItemIndex := ListBox1.Items.Add( MyString );
  RichEdit1.Lines.Add( MyString );

  //  RichEdit1.SelStart := RichEdit1.SelStart - 2; // optional, preceed the CR+LF

  // RichEdit1.SelStart := RichEdit1.SelStart - Length( MyString ) - 2; // optional, start of added string
  // RichEdit1.SelLength := Length( MyString );

  SendMessage( RichEdit1.Handle, EM_SCROLLCARET, 0, 0 );

Uncomment the commented lines to get variations on the richedit selections after adding.

/// John
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1361756
For the listbox, you can also use this way....

Listbox1.ItemIndex := Lo(listbox1.Items.count - 1);

Hope this helps a bit!

Regards,
Viktor Ivanov
0
 
LVL 1

Author Comment

by:mortenmo
ID: 1361757
Thanks ;)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

801 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