A Workaround - just a thought...

what about using TPanels contained in a TPanel
eg.
1 TPanel Aligned alBottom Called pnlStatusBar
3 TPanels contained in pnlStatusBar
        one aligned alLeft Called pnlStatusText
        one Aligned alCenter Called pnlStatusDate
        one Aligned AlRight Called pnlStatusTime

Update the only ones you require as needed.

Regards
Paul
[EMAIL PROTECTED]


-----Original Message-----
From: Chris Crowe [mailto:[EMAIL PROTECTED]]
Sent: Friday, 02 July 1999 01:13 PM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Flicker - with LockWindowUpdate(EditControl.handle);


Are you stating the help file here for LockWindowUpdate?. Because that is
the way it reads, but in reality it does not work like that for me.

It causes the whole screen to be redrawn...

When I use it I am passing it the handle of the window, and when I am
finished I pass it 0.

LockWindowUpdate(handle);

do something

lockWindowUpdate(0);


>From the Delphi Help File:

If an application with a locked window (or any locked child windows) calls
the GetDC, GetDCEx, or BeginPaint function, the called function returns a
device context with a visible region that is empty. This will occur until
the application unlocks the window by calling LockWindowUpdate, specifying a
value of NULL for hWndLock.

If an application attempts to draw within a locked window, the system
records the extent of the attempted operation in a bounding rectangle. When
the window is unlocked, the system invalidates the area within this bounding
rectangle, forcing an eventual WM_PAINT message to be sent to the previously
locked window and its child windows. If no drawing has occurred while the
window updates were locked, no area is invalidated.

Chris

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Paul Heinz
Sent: Friday, July 02, 1999 11:28 AM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Flicker - with LockWindowUpdate(EditControl.handle);


Hi, all.

> Since I'm having problems with a flickering statusbar, I tried using
> LockWindowUpdate and got exactly the same results as you! When I call
> LockWindowUpdate(0) the entire screen repaints, in fact the only
> thing that
> doesn't flicker is my statusbar!
>
> Surely this has to be a Windows bug - I'm using NT Workstation 4.0 SP5 -
> what OS are you using?

Hrmm... I don't think so. All that LockWindowUpdate does is defer and
aggregate all the WM_PAINT messages into one large rectangular repaint of
the whole control rather that lots of little repaints of smaller elements,
so it will reduce lots of little flickers into one big flicker which is
sometimes 'good enough'.

To eliminate flicker is a much trickier task and involves overriding the
WM_ERASEBKGND message and rewriting your painting code to only touch each
pixel (or region of pixels) one. I believe Max Nilson (our resident painting
and controls guru) mentioned this technique in an earlier email.

So think Renee of 'All 'Allo 'I will paint you only once....' :-)

Coding in this style involves a little more effort and places a higher load
in terms of CPU usage (region manipulation) on the video bandwidth to your
video card (often much of this stuff is done in card memory) but with modern
Win95 machines and video cards, this is not really a concern.

That is unless you plan to support 486's with older SVGA cards :-) We've run
our code on such a minimal Win95 install spec box and whilst it doesn't
flicker, you can tell the video card and CPU are 'feeling the burn' slightly
:-)

TTFN,
  Paul.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to