MFC Subclassed control FLICKERS?

MFC Subclassed control FLICKERS?

Post by gh » Wed, 22 Aug 2001 12:34:42



Hi,
I have an app, written on NT 4.0 sp6, using Visual Studio 6 sp5.  It has
been tested on NT4 without any problems, but when I run the app on W2K Adv.
Server, sp2, I noticed that certain MFC-subclassed controls (controls I
created, derived from things like CComboBox, CListBox), "flicker" whenever I
hover the mouse over them, under certain conditions.  For items placed
directly on a CFormView, this does not occur, but it DOES occur for things
like : a combobox (derived from CComboBox) on a CToolBar object.  Whenever I
hover the mouse over this particular example, the control is constantly
repainting itself at a frantic rate.  Anyone have any suggestions as to what
messages (if any) I might need to intercept?  I'm an experienced C++
developer, but a relative neophyte in the world of MFC/Win32.  Any/all
suggestions are obviously appreciated...
 
 
 

MFC Subclassed control FLICKERS?

Post by David Phillip Oste » Wed, 22 Aug 2001 15:19:26




> Anyone have any suggestions as to what messages (if any) I might
> need to intercept?  

Are you overriding ERASE_BACKGROUND to not draw? a common mistake is to
leave the default ERASE_BACKGROUND, which clears to the background
color, then have PAINT draw over it. Even if PAINT is using a DIB to
avoid flicker during the draw, the ERASE followed by the PAINT creates
flicker.

 
 
 

MFC Subclassed control FLICKERS?

Post by gh » Wed, 22 Aug 2001 21:10:21


Actually, I am overriding  OnEraseBackground to simply return TRUE.  This
flickering only occurs in the case where i hover the mouse cursor over a
combobox that is embedded within a toolbar.  It does not occur for
comboxboxes (or anyother control, for that matter), when they are in
CFormViews.  I'm stumped.





> > Anyone have any suggestions as to what messages (if any) I might
> > need to intercept?

> Are you overriding ERASE_BACKGROUND to not draw? a common mistake is to
> leave the default ERASE_BACKGROUND, which clears to the background
> color, then have PAINT draw over it. Even if PAINT is using a DIB to
> avoid flicker during the draw, the ERASE followed by the PAINT creates
> flicker.

 
 
 

MFC Subclassed control FLICKERS?

Post by Russ Freema » Thu, 23 Aug 2001 03:27:04



Quote:> Actually, I am overriding  OnEraseBackground to simply return TRUE.  This
> flickering only occurs in the case where i hover the mouse cursor over a
> combobox that is embedded within a toolbar.  It does not occur for
> comboxboxes (or anyother control, for that matter), when they are in
> CFormViews.  I'm stumped.

Take a look at your command update code (can't remember what it's called,
the callback you get to control whether the tooltbar object is enabled).
What's it doing? Perhaps it is updating the control which causes it to
flicker. If that's the case try setting WM_SETREDRAW before and after
updating the control.

If the above doesn't help why not post a small sample project to a web site,
give us the URL and offer a prize to the person to post a fix first
<vbg>...only kidding, post the code and someone will take a look. Make it
easy for us to hack it for you ;-)

--
russ.
http://www.gipsysoft.com/qhtm/ - FREE HTML display in a small and light DLL
http://www.gipsysoft.com/ZoomPlus/ - Programmers Zoom Utility on Steroids
http://www.kingcoder.com/ - Contract software developer

 
 
 

1. MFC ActiveX control inside another MFC ActiveX control - MFC Bug

Hi.
I have to ActiveX Controls created using the AppControl Wizard
provided by Visual C++ 5. I want to create the first control inside
the second control , and here is what happens.

I create the first control in the OnCreate method of the second object
using a wrapper class created using the Component Wizard. When I
create the (first) control I get an assertion in Wincore.cpp in
CWnd::Attach saying that the window is already mapped (was attached
already), everything works fine if I ignore but when the application
closes it raises an exception and dies (sometimes taking the whole
system with it). I traced inside MFC code and found out that when I
call create and finally Windows creates the window, MFC's hook
function that hooks windows creations attaches the windows before
COleControlSite has a chance to do so, and that's why it asserts.
Didn't the guys at Microsoft think about this situation ?

What do I do ?

Another question : Is there any mechanism to show dialog templates
inside a control - something like COleFormControl ???

   Thanks a buch,
      - Dror Kremer

P.S.

Please reply both by post and e-mail. Thank you !
-----------------------------------------------------------------
Dror Kremer                                 | Oh Margie you came
Team OS/2                                   | and you found me a    
                                            | turkey, on my
  E-mail:                                   | vacation away from

  Fidonet:                                  |                    
    97:200/118.3                            |    - Homer Simpson
                                            |                    
* Finger for PGP Key, Accepting VoiceChat/2 |
  Calls.                                    |
-----------------------------------------------------------------

2. Problematic hp vectra with misc. upgrades from someone with to little windows experiance

3. << HELP >> User-defined Custom Control subclass in a CFormView subclass

4. Accessing devices directly under NT...help!

5. OLE Custom Control Subclassing Window control

6. How to access the owner information ?

7. How to create an OLE control that subclasses a derived control

8. MFC from Code Warrior ->VC?

9. Subclassed CStatic - My hand cursor flickers!

10. Subclassing standard windows controls with an ole control

11. Flicker-Flicker-Flicker (Netscape and MS IEx)

12. Subclassing with MFC

13. Problems Subclassing a Subclassed child