Board index » delphi » preventing TMemo from scrolling while adding content

preventing TMemo from scrolling while adding content

I'm using a TMemo to display a small piece of a huge file.  As the user
scrolls, I use the OnMouse and OnKey events to load more content.

My question is: How do I add lines to the memo component (beginning or
end) without changing the cursor position or scroll view?  Basically I
would like you have more lines added to the TMemo in the background so
it's transparent to the user (except maybe a change in the vertical
scroller).

When I used memo1.lines.add, the cursor moves to the bottom of the
added content.  I've tried saving the SelStart to a temp variable and
reassigning it, but that doesn't work.

I've searched everywhere for a solution to this, so any help would be
appreciated.  Thanks.

Rich

Sent via Deja.com
http://www.deja.com/

 

Re:preventing TMemo from scrolling while adding content


Quote
<rmdhous...@my-deja.com> wrote in message

news:95g3b2$cq1$1@nnrp1.deja.com...

Quote
> My question is: How do I add lines to the memo component (beginning or
> end) without changing the cursor position or scroll view?  Basically I
> would like you have more lines added to the TMemo in the background so
> it's transparent to the user (except maybe a change in the vertical
> scroller).

Hi,

Try this:

with memo1.lines do begin
  BeginUpdate; // inhibits display updating
  add('klsjdhflksjfslk');
  add('qskdjflskjdfhlqskdj');
  .....
  .....
  add('qksdjfhlkqsjdfh');
  EndUpdate; // display is updated now
end;

HTH's
GRS

Other Threads