Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Is there a way to make a pageflipping form?

Posted on 1998-07-09
7
Medium Priority
?
168 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
[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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Accepted Solution

by:
Matvey earned 300 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

610 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