Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Optimization
Expertise: Beginner
Mar 28, 1997

Dynamic Buffer

Question:
I'm using Delphi to do a client-server application in which all the lines I get from a socket I send to a TMemo in my form. I want that Tmemo to have a 200 lines buffer so that if it has more than 200 lines I delete the first line. How can I prevent the Tmemo from jumping up and down, focusing the first and then the last line in the buffer? How can I "freeze" the Tmemo visualization? How can I prevent the scroll bar from moving?

Answer:
To "freeze" the update of the screen while you're updating so that the user can't really see what's going on, just enclose the code that you want "hidden" from the user between the following:

LockWindowUpdate(Form1.Handle);
  ...code that you want to hide
LockWindowUpdate(0);
LockWindowUpdate is a WinAPI call that "freezes" the screen. All you do is provide the handle of the window you want frozen, then all updates to the window aren't made. LockWindowUpdate(0) resumes screen updating.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date