Flicker during resize in CListViewCtrl 
Author Message
 Flicker during resize in CListViewCtrl

I am having trouble with overriding functions (limited documentation). I
am working to set the cursor for the listview to be a cross (IDC_CROSS)
and remove the CS_HREDRAW &CS_VREDRAW to eliminate the flicker during
resizing (Q183210).  I thought I made the appropriate changes (see
below) yet the view does not display the cross cursor and the flicker is
still present. What else is needed to invoke the
ListCtrl::GetWndClassInfo()? Are there examples of what I am trying to
do in ATL?

// ListCtrl.h
class ListCtrl : public CWindowImpl<ListCtrl, CListViewCtrl>
{
public:
 ListCtrl();
 virtual ~ListCtrl();

   BEGIN_MSG_MAP(ListCtrl)
      MESSAGE_HANDLER(WM_PAINT, OnPaint)
   END_MSG_MAP()

public:
 LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/,
BOOL& /*bHandled*/);

   static CWndClassInfo& GetWndClassInfo()
   {
      static CWndClassInfo wc = {
         {
            sizeof(WNDCLASSEX),
            0,
            StartWindowProc,
            0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
            _T("ListCtrl"), NULL
         },
         NULL, NULL, IDC_CROSS, TRUE, 0, _T("")
      };
      return wc;
   };

Quote:
};

// Status.cpp
Status::Status() : list_view(NULL), view_handle(NULL)
{
   list_view = new ListCtrl;

Quote:
}

Status::~Status()
{
   if (list_view)
      delete list_view;

Quote:
}

HRESULT Status::open(const HWND hWnd)
{
   if (list_view) {
      RECT rect;
      ::GetClientRect(hWnd, &rect);

      HWND h = list_view->Create(hWnd, rect, _T("ListCtrl"),
                                                   WS_CHILD        |
                                                   WS_VISIBLE      |
                                                   WS_CLIPSIBLINGS |
                                                   WS_CLIPCHILDREN |
                                                   LVS_REPORT,
                                                   WS_EX_CLIENTEDGE);
    return S_OK;

Quote:
}



Tue, 23 Mar 2004 04:09:45 GMT  
 Flicker during resize in CListViewCtrl

Try overriding the ERASEBK message or whatever too. Paranoia is a good
thing.

Later,
Matt

Quote:
> I am having trouble with overriding functions (limited documentation). I
> am working to set the cursor for the listview to be a cross (IDC_CROSS)
> and remove the CS_HREDRAW &CS_VREDRAW to eliminate the flicker during
> resizing (Q183210).  I thought I made the appropriate changes (see
> below) yet the view does not display the cross cursor and the flicker is
> still present. What else is needed to invoke the
> ListCtrl::GetWndClassInfo()? Are there examples of what I am trying to
> do in ATL?



Tue, 23 Mar 2004 22:30:02 GMT  
 Flicker during resize in CListViewCtrl

How would you suggest the override on the "EraseBackground" would be written
to prevent flicker?
This still does not address change the cursor for the view. Why the code
example did not work?

Thanks for your help,

    R

Quote:

> Try overriding the ERASEBK message or whatever too. Paranoia is a good
> thing.

> Later,
> Matt

> > I am having trouble with overriding functions (limited documentation). I
> > am working to set the cursor for the listview to be a cross (IDC_CROSS)
> > and remove the CS_HREDRAW &CS_VREDRAW to eliminate the flicker during
> > resizing (Q183210).  I thought I made the appropriate changes (see
> > below) yet the view does not display the cross cursor and the flicker is
> > still present. What else is needed to invoke the
> > ListCtrl::GetWndClassInfo()? Are there examples of what I am trying to
> > do in ATL?



Wed, 24 Mar 2004 01:10:26 GMT  
 Flicker during resize in CListViewCtrl
Alright-- I should have looked closer.

1. Try starting off of DECLARE_WND_SUPERCLASS("NewListCtrl", "ListCtrl"); or
NULL instead of "NewListCtrl" and try to make the necessary changes to that
macro to change cursor and background color. Why? Because you need to
superclass it, your making changes to a window class that has nothing to do
with the ListCtrl window class already registered.

2. And don't create the window using "ListCtrl"--thats basically telling it
to create a list control using the same window class thats already
registered. Of course changing it wont work, because your changing what is
an ATL created window class name. Hence, leaving it a default parameter
should work, or use MyWnd::GetWndClassName() which should grab it right from
the static structure.

So there's two changes to be made.

Later,
Matt

Quote:
> How would you suggest the override on the "EraseBackground" would be
written
> to prevent flicker?
> This still does not address change the cursor for the view. Why the code
> example did not work?

> Thanks for your help,

>     R


> > Try overriding the ERASEBK message or whatever too. Paranoia is a good
> > thing.

> > Later,
> > Matt

> > > I am having trouble with overriding functions (limited documentation).
I
> > > am working to set the cursor for the listview to be a cross
(IDC_CROSS)
> > > and remove the CS_HREDRAW &CS_VREDRAW to eliminate the flicker during
> > > resizing (Q183210).  I thought I made the appropriate changes (see
> > > below) yet the view does not display the cross cursor and the flicker
is
> > > still present. What else is needed to invoke the
> > > ListCtrl::GetWndClassInfo()? Are there examples of what I am trying to
> > > do in ATL?



Wed, 24 Mar 2004 04:32:37 GMT  
 Flicker during resize in CListViewCtrl
Hmm... thank you for the suggested changes. I believe I have correctly implement
them, yet I get an ERROR_CLASS_DOES_NOT_EXIST when creating the view. This same
error occurs if I used the default Window name (NULL). Something missing?

Thanks in Advance...

    R

///////////////////////////////////////////////////////////////////////////////
class ListCtrl : public CWindowImpl<ListCtrl, CListViewCtrl>
{
public:
 ListCtrl();
 virtual ~ListCtrl();

public:
   BEGIN_MSG_MAP(ListCtrl)
      MESSAGE_HANDLER(WM_PAINT, OnPaint)
   END_MSG_MAP()

public:
 LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&
/*bHandled*/);

   // DECLARE_WND_SUPERCLASS(_T("NewListCtrl"), GetWndClassName())
   static CWndClassInfo& GetWndClassInfo()
   {
      static CWndClassInfo wc = {
         {
            sizeof(WNDCLASSEX),
            0,
            StartWindowProc,
            0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
            _T("NewListCtrl"), NULL
         },
         GetWndClassName() , NULL, IDC_CROSS, TRUE, 0, _T("")
      };
      return wc;
   };

   static LPCTSTR GetWndClassName() { return _T("NewListCrtl"); };

Quote:
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////

HRESULT Status::open(const HWND hWnd)
{
   HRESULT hr = S_FALSE;

   if (list_view) {
      RECT rect;
      ::GetClientRect(hWnd, &rect);

/*      HWND h = list_view->Create(hWnd, rect, NULL,  */
      HWND h = list_view->Create(hWnd, rect, list_view->GetWndClassName(),
                                                   WS_CHILD        |
                                                   WS_VISIBLE      |
                                                   WS_CLIPSIBLINGS |
                                                   WS_CLIPCHILDREN |
                                                   LVS_REPORT,
                                                   WS_EX_CLIENTEDGE);
      if (!h) {
         UINT err = ::GetLastError();
         hr = E_FAIL;
      }

    return hr;

Quote:
}

> Alright-- I should have looked closer.

> 1. Try starting off of DECLARE_WND_SUPERCLASS("NewListCtrl", "ListCtrl"); or
> NULL instead of "NewListCtrl" and try to make the necessary changes to that
> macro to change cursor and background color. Why? Because you need to
> superclass it, your making changes to a window class that has nothing to do
> with the ListCtrl window class already registered.

> 2. And don't create the window using "ListCtrl"--thats basically telling it
> to create a list control using the same window class thats already
> registered. Of course changing it wont work, because your changing what is
> an ATL created window class name. Hence, leaving it a default parameter
> should work, or use MyWnd::GetWndClassName() which should grab it right from
> the static structure.

> So there's two changes to be made.

> Later,
> Matt



Wed, 24 Mar 2004 12:09:51 GMT  
 Flicker during resize in CListViewCtrl
You use GetWndClassName() to return the class name of "ListCtrl", thats
incorrect-- you just overriden it to return NewListCtrl. Try using
CListCtrl::GetWndClassName and see if that helps.

Matt

Quote:
> Hmm... thank you for the suggested changes. I believe I have correctly
implement
> them, yet I get an ERROR_CLASS_DOES_NOT_EXIST when creating the view. This
same
> error occurs if I used the default Window name (NULL). Something missing?

> Thanks in Advance...

>     R

////////////////////////////////////////////////////////////////////////////
///
Quote:
> class ListCtrl : public CWindowImpl<ListCtrl, CListViewCtrl>
> {
> public:
>  ListCtrl();
>  virtual ~ListCtrl();

> public:
>    BEGIN_MSG_MAP(ListCtrl)
>       MESSAGE_HANDLER(WM_PAINT, OnPaint)
>    END_MSG_MAP()

> public:
>  LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/,
BOOL&
> /*bHandled*/);

>    // DECLARE_WND_SUPERCLASS(_T("NewListCtrl"), GetWndClassName())
>    static CWndClassInfo& GetWndClassInfo()
>    {
>       static CWndClassInfo wc = {
>          {
>             sizeof(WNDCLASSEX),
>             0,
>             StartWindowProc,
>             0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
>             _T("NewListCtrl"), NULL
>          },
>          GetWndClassName() , NULL, IDC_CROSS, TRUE, 0, _T("")
>       };
>       return wc;
>    };

>    static LPCTSTR GetWndClassName() { return _T("NewListCrtl"); };

> };

////////////////////////////////////////////////////////////////////////////
///////////////////////////////

- Show quoted text -

Quote:

> HRESULT Status::open(const HWND hWnd)
> {
>    HRESULT hr = S_FALSE;

>    if (list_view) {
>       RECT rect;
>       ::GetClientRect(hWnd, &rect);

> /*      HWND h = list_view->Create(hWnd, rect, NULL,  */
>       HWND h = list_view->Create(hWnd, rect, list_view->GetWndClassName(),
>                                                    WS_CHILD        |
>                                                    WS_VISIBLE      |
>                                                    WS_CLIPSIBLINGS |
>                                                    WS_CLIPCHILDREN |
>                                                    LVS_REPORT,
>                                                    WS_EX_CLIENTEDGE);
>       if (!h) {
>          UINT err = ::GetLastError();
>          hr = E_FAIL;
>       }

>     return hr;
> }


> > Alright-- I should have looked closer.

> > 1. Try starting off of DECLARE_WND_SUPERCLASS("NewListCtrl",
"ListCtrl"); or
> > NULL instead of "NewListCtrl" and try to make the necessary changes to
that
> > macro to change cursor and background color. Why? Because you need to
> > superclass it, your making changes to a window class that has nothing to
do
> > with the ListCtrl window class already registered.

> > 2. And don't create the window using "ListCtrl"--thats basically telling
it
> > to create a list control using the same window class thats already
> > registered. Of course changing it wont work, because your changing what
is
> > an ATL created window class name. Hence, leaving it a default parameter
> > should work, or use MyWnd::GetWndClassName() which should grab it right
from
> > the static structure.

> > So there's two changes to be made.

> > Later,
> > Matt



Thu, 25 Mar 2004 10:06:30 GMT  
 Flicker during resize in CListViewCtrl
When creating the ListCtrl, I don't seem to be able to access the "superclass."
I have tried references to CListViewCtrl::GetWndClassName(),
ListCtrl::GetWndClassName(), the passing the default (NULL). All return the
"class does not exist" error (error code 1411).  I suspect I just miss one
minor thing (which is giving me a major headache). But I cannot see what that
is.  Any other suggestions?

Looking for clues...

    R

Quote:

> You use GetWndClassName() to return the class name of "ListCtrl", thats
> incorrect-- you just overriden it to return NewListCtrl. Try using
> CListCtrl::GetWndClassName and see if that helps.

> Matt

> > Hmm... thank you for the suggested changes. I believe I have correctly
> implement
> > them, yet I get an ERROR_CLASS_DOES_NOT_EXIST when creating the view. This
> same
> > error occurs if I used the default Window name (NULL). Something missing?

> > Thanks in Advance...

> >     R

> ////////////////////////////////////////////////////////////////////////////
> ///
> > class ListCtrl : public CWindowImpl<ListCtrl, CListViewCtrl>
> > {
> > public:
> >  ListCtrl();
> >  virtual ~ListCtrl();

> > public:
> >    BEGIN_MSG_MAP(ListCtrl)
> >       MESSAGE_HANDLER(WM_PAINT, OnPaint)
> >    END_MSG_MAP()

> > public:
> >  LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/,
> BOOL&
> > /*bHandled*/);

> >    // DECLARE_WND_SUPERCLASS(_T("NewListCtrl"), GetWndClassName())
> >    static CWndClassInfo& GetWndClassInfo()
> >    {
> >       static CWndClassInfo wc = {
> >          {
> >             sizeof(WNDCLASSEX),
> >             0,
> >             StartWindowProc,
> >             0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
> >             _T("NewListCtrl"), NULL
> >          },
> >          GetWndClassName() , NULL, IDC_CROSS, TRUE, 0, _T("")
> >       };
> >       return wc;
> >    };

> >    static LPCTSTR GetWndClassName() { return _T("NewListCrtl"); };

> > };

> ////////////////////////////////////////////////////////////////////////////
> ///////////////////////////////

> > HRESULT Status::open(const HWND hWnd)
> > {
> >    HRESULT hr = S_FALSE;

> >    if (list_view) {
> >       RECT rect;
> >       ::GetClientRect(hWnd, &rect);

> > /*      HWND h = list_view->Create(hWnd, rect, NULL,  */
> >       HWND h = list_view->Create(hWnd, rect, list_view->GetWndClassName(),
> >                                                    WS_CHILD        |
> >                                                    WS_VISIBLE      |
> >                                                    WS_CLIPSIBLINGS |
> >                                                    WS_CLIPCHILDREN |
> >                                                    LVS_REPORT,
> >                                                    WS_EX_CLIENTEDGE);
> >       if (!h) {
> >          UINT err = ::GetLastError();
> >          hr = E_FAIL;
> >       }

> >     return hr;
> > }


> > > Alright-- I should have looked closer.

> > > 1. Try starting off of DECLARE_WND_SUPERCLASS("NewListCtrl",
> "ListCtrl"); or
> > > NULL instead of "NewListCtrl" and try to make the necessary changes to
> that
> > > macro to change cursor and background color. Why? Because you need to
> > > superclass it, your making changes to a window class that has nothing to
> do
> > > with the ListCtrl window class already registered.

> > > 2. And don't create the window using "ListCtrl"--thats basically telling
> it
> > > to create a list control using the same window class thats already
> > > registered. Of course changing it wont work, because your changing what
> is
> > > an ATL created window class name. Hence, leaving it a default parameter
> > > should work, or use MyWnd::GetWndClassName() which should grab it right
> from
> > > the static structure.

> > > So there's two changes to be made.

> > > Later,
> > > Matt



Fri, 26 Mar 2004 01:56:57 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Flickering during Resizing

2. Flicker during paint

3. resizing toolbar flickers on SDI

4. Flickering MDI app when resizing

5. How to Reduce flickering when resize HtmlView?

6. flicker when resizing formview controls

7. no flickering listbox on resize

8. Resize Causes Flicker

9. Resizing window, causes flicker

10. Avoid flicker on resize?

11. View flickers when resizing MDI frame

12. Flicker while resizing a window

 

 
Powered by phpBB® Forum Software