Solved

Disable window update

Posted on 2002-05-10
6
944 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Comparing dates in Delphi. Greater than/ Less than 3 119
LAN or WAN ? 11 82
Multiple image collision 13 69
How to define IfThen functions in one common unit? 4 45
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now