troubleshooting Question

Trichedit scrolling

Avatar of PatrickWolo
PatrickWolo asked on
Delphi
13 Comments1 Solution981 ViewsLast Modified:
I Currently have a trichedit with a scrollbar. This trichedit gets text from a socket and then adds that text to the bottom. Also if the total lines in the trichedit exceeds 100, the lines at the top are deleted. Im trying to keep the view at the bottom of the text by calling richedit1.perform(EM_SCROLL,SB_BOTTOM,0) but what happens is that as soon as lines are deleted via richedit1.lines.delete(0) the richedit scrolls to line 0 (the one being deleted). Therefore my perform and the lines.delete are constantly pulling the richedit from top to bottom and vice versa, causing a bit of flicker.

Anyone know how do either delete the lines "silently" or how to stop the flickering?

Heres my code:
output is the richedit, thestring is what im adding at the bottom.

 procedure TMainForm.myprint(thestring: string);
 begin
    output.lines.beginUpdate;
    while output.Lines.Count > 100 do
      output.Lines.Delete(0); //this pulls the scrollbar top the top
    output.SelStart := length(ausgabe.text);
    output.SelText := thestring;
    output.perform(EM_SCROLL,SB_BOTTOM,0); //this puts it back where its supposed to be
    output.lines.EndUpdate;
  end;
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros