Solved

Is there a way to make a pageflipping form?

Posted on 1998-07-09
7
144 Views
Last Modified: 2010-04-04
I have an application which does a lot of manual painting (including filling the background on WM_ERASEBKGND). The problem is when I do things like changing the text of a label run-time, I get some flashing. Sometimes only the control itself, but sometimes the whole form. I would like to do some sort of pageflipping to avoid this. Any suggestions? My first thought was to change the form's device context to a memory-dc, and then copy the whole image to the screen, but it is read only... And would this be awfully slow?

/Pede
0
Comment
Question by:pede
  • 4
  • 2
7 Comments
 
LVL 7

Expert Comment

by:BlackMan
ID: 1357458
You could try the LockWindowUpdate function. Here is a snip from the description:

The LockWindowUpdate function disables or reenables drawing in the specified window. Only one window can be locked at a time.

BOOL LockWindowUpdate(

    HWND hWndLock       // handle of window to lock  
   );      
 
0
 
LVL 1

Author Comment

by:pede
ID: 1357459
I forgot to mention that I already use the LockWindowUpdate. It helps quite a bit, but it's not even close to perfect.

Sorry, my mistake.

/Pede

0
 
LVL 1

Author Comment

by:pede
ID: 1357460
What about only unlocking the window in the vertical retrace period? Like, LockWindowUpdate(Handle), do stuff, WaitforVerticalBlanc, LockWindowUpdate(0).

How do I wait for vertical retrace? It has to run on both 3.1, 95 and NT.

/Pede

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 3

Accepted Solution

by:
Matvey earned 100 total points
ID: 1357461
pede, I think that the best thing to help you is some sources. You can find a unit at the following address that has a method to avoid the fliccering:

http://bes.trendline.co.il/torry/vcl/packs/yupack.zip

Look at the sources for the button and the drawing procedures at the end of the unit.

Cheers, bosism@netvision.net.il
0
 
LVL 1

Author Comment

by:pede
ID: 1357462
Well, this source definately works. But I was hoping for a more 'global' solution. This way I have to make a custom class (with quite a lot of code in it) for every control I use. I get the idea though, and I will reduce some of the worst flickering this way.

Cheers,

/Pede

0
 
LVL 1

Author Comment

by:pede
ID: 1357463
Actually I have another comment, if anybody finds this subject interesting. I wrote that the LockWindowUpdate()-method helped quite a bit. Well, in some ways it does, but sometimes it makes the whole client area flash when you unlock it! If the whole point is to make a flicker-free application, that's pretty bad ...
So far the only bulletproof way (that  I know of), is to do a lot of blitting  yourself. This is how it's done in the source suggested by Matvey.

/Pede

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1357464
You don't have to implement many time the same drwing procedure you see in the unit, and you don't necessary need classes for them. You can copy the methods to one unit and add it to the USES clause whenever you need drawing for your application.

Sorry if my answere wasn't helpful to you. I'll try my best to help you farther if you have problems,
Regards, Matvey
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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