Solved

Disable window update

Posted on 2002-05-10
6
948 Views
Last Modified: 2011-09-20
hi,
is it possible to disable update of a control? it is a very slow process to insert lines to a tmemo control while the visual update in effect.
thanks
0
Comment
Question by:omavideniz
[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
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7001624
memo1.lines.beginupdate;

don't forget

memo1.lines.endupdate;

after your insert action

meikl ;-)
0
 
LVL 10

Expert Comment

by:Jacco
ID: 7001644
Hi all,

I agree with meikl. I just wanted to say thay I always put the BeginUpdate/EndUpdate in a try/finally structure:

Memo1.Lines.BeginUpdate;
try
  .. code adding lines ..
finally
  Memo1.Lines.BeginUpdate;
end;

Regards Jacco
0
 
LVL 10

Expert Comment

by:Jacco
ID: 7001646
Oops (cut and past is not always very good)

Memo1.Lines.BeginUpdate;
try
 .. code adding lines ..
finally
 Memo1.Lines.EndUpdate;
end;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:SteveWaite
ID: 7002140
 LockWindowUpdate(Memo1.Handle);
  // do your stuff
  // ..
  LockWindowUpdate(0);

Regards,
Steve
0
 
LVL 2

Expert Comment

by:mikepj
ID: 7002792
When I've needed something with a bit more strength, this is what is use:

with mywincontrol do
 begin
  Perform( WM_SETREDRAW, 0, 0 );
  try
    ...
  finally
    Perform( WM_SETREDRAW, 1, 0 );
    Invalidate;
  end;
 end;

0
 
LVL 2

Expert Comment

by:Hagen040798
ID: 7004339
All above methods don't speedup real, because the painting code is indeed executed, but with one exception. Any response to get a "visible" DeviceContext to the Screen retruns a invalid or virtual DC. This avoid that the following Paintingcode paints on the screen, but don't avoid this Paintingcode itself.
Ok, the System detect this state by every call to functions like Invalidate() or RedrawWindow() and avoid now some addtional code.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 112
Controlled Assessment GCSE - desperate help needed 4 121
Delphi: barcode reading on android platform 1 100
Posting a string with PostMessage 23 48
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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…

738 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