Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Subclassed Listview not sending any notifications...

Subclassed Listview not sending any notifications...

Scheduled Pinned Locked Moved ATL / WTL / STL
12 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tommy2k
    wrote on last edited by
    #1

    When i add notification handlers like this one here, NOTIFY_CODE_HANDLER(NM_CLICK,OnClick) the functions aren't called. I guess i must have done something wrong subclassing this listview but i don't know what.

    J 1 Reply Last reply
    0
    • T Tommy2k

      When i add notification handlers like this one here, NOTIFY_CODE_HANDLER(NM_CLICK,OnClick) the functions aren't called. I guess i must have done something wrong subclassing this listview but i don't know what.

      J Offline
      J Offline
      Joao Paulo Figueira
      wrote on last edited by
      #2

      Tommy2k wrote: I guess i must have done something wrong subclassing this listview but i don't know what. Can you show the code?

      T 1 Reply Last reply
      0
      • J Joao Paulo Figueira

        Tommy2k wrote: I guess i must have done something wrong subclassing this listview but i don't know what. Can you show the code?

        T Offline
        T Offline
        Tommy2k
        wrote on last edited by
        #3

        class CContactlist : public CWindowImpl { private: CImageList ContactImageList; TimContact TimContactlist[256]; int NumberOfContactsLoaded; CStatic tHyperlink; CAnimateCtrl tAnim; int colormsg; CFont hLinkFont,hLinkFont2; public: DECLARE_WND_SUPERCLASS(NULL, CListViewCtrl::GetWndClassName()) BOOL PreTranslateMessage(MSG* pMsg); BEGIN_MSG_MAP(CContactlist) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_CTLCOLORSTATIC,OnCtrlColorStatic) MESSAGE_HANDLER(WM_CONTEXTMENU,OnContextMenu) NOTIFY_CODE_HANDLER(NM_CLICK,OnActivateItem) END_MSG_MAP() friend class CTimUser; CContactlist(); ~CContactlist(); void Setup(); void OnParentSize(HWND hWndParent); BOOL LoadImagelist(); void ShowCancelLogin(bool show); void AddContactToList(CAtlString * Username, CAtlString * Email, CAtlString * Nickname, int Status, bool Blocked); protected: // Handler prototypes (uncomment arguments if needed): // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled); LRESULT OnCtrlColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnContextMenu(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnActivateItem(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { MessageBox("blah"); return 0; } }; It's the CLICK one that doesn't work... Thnx

        J 1 Reply Last reply
        0
        • T Tommy2k

          class CContactlist : public CWindowImpl { private: CImageList ContactImageList; TimContact TimContactlist[256]; int NumberOfContactsLoaded; CStatic tHyperlink; CAnimateCtrl tAnim; int colormsg; CFont hLinkFont,hLinkFont2; public: DECLARE_WND_SUPERCLASS(NULL, CListViewCtrl::GetWndClassName()) BOOL PreTranslateMessage(MSG* pMsg); BEGIN_MSG_MAP(CContactlist) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_CTLCOLORSTATIC,OnCtrlColorStatic) MESSAGE_HANDLER(WM_CONTEXTMENU,OnContextMenu) NOTIFY_CODE_HANDLER(NM_CLICK,OnActivateItem) END_MSG_MAP() friend class CTimUser; CContactlist(); ~CContactlist(); void Setup(); void OnParentSize(HWND hWndParent); BOOL LoadImagelist(); void ShowCancelLogin(bool show); void AddContactToList(CAtlString * Username, CAtlString * Email, CAtlString * Nickname, int Status, bool Blocked); protected: // Handler prototypes (uncomment arguments if needed): // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/); LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled); LRESULT OnCtrlColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnContextMenu(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnActivateItem(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { MessageBox("blah"); return 0; } }; It's the CLICK one that doesn't work... Thnx

          J Offline
          J Offline
          Joao Paulo Figueira
          wrote on last edited by
          #4

          Ok, what you want is to reflect notifications. For this you will have to add REFLECT_NOTIFICATIONS() to the bottom of the containing window's message map:

          BEGIN_MSG_MAP(thisClass)
          ...
          REFLECT_NOTIFICATIONS()
          END_MSG_MAP()

          Then, change your NOTIFY_CODE_HANDLER with REFLECTED_NOTIFY_CODE_HANDLER. You may also want to add a DEFAULT_REFLECTION_HANDLER() to the end of your List's message map. Things should work, now.

          T 1 Reply Last reply
          0
          • J Joao Paulo Figueira

            Ok, what you want is to reflect notifications. For this you will have to add REFLECT_NOTIFICATIONS() to the bottom of the containing window's message map:

            BEGIN_MSG_MAP(thisClass)
            ...
            REFLECT_NOTIFICATIONS()
            END_MSG_MAP()

            Then, change your NOTIFY_CODE_HANDLER with REFLECTED_NOTIFY_CODE_HANDLER. You may also want to add a DEFAULT_REFLECTION_HANDLER() to the end of your List's message map. Things should work, now.

            T Offline
            T Offline
            Tommy2k
            wrote on last edited by
            #5

            Thanks for explaining me this! However, it still doesn't work....function isn't called...

            J 1 Reply Last reply
            0
            • T Tommy2k

              Thanks for explaining me this! However, it still doesn't work....function isn't called...

              J Offline
              J Offline
              Joao Paulo Figueira
              wrote on last edited by
              #6

              What are the template arguments for CWindowImpl?

              T 1 Reply Last reply
              0
              • J Joao Paulo Figueira

                What are the template arguments for CWindowImpl?

                T Offline
                T Offline
                Tommy2k
                wrote on last edited by
                #7

                class CContactlist : public CWindowImpl

                J 1 Reply Last reply
                0
                • T Tommy2k

                  class CContactlist : public CWindowImpl

                  J Offline
                  J Offline
                  Joao Paulo Figueira
                  wrote on last edited by
                  #8

                  Shouldn't this be:

                  class CContactlist : public CWindowImpl<CContactList, CListViewCtrl>

                  ?

                  T 1 Reply Last reply
                  0
                  • J Joao Paulo Figueira

                    Shouldn't this be:

                    class CContactlist : public CWindowImpl<CContactList, CListViewCtrl>

                    ?

                    T Offline
                    T Offline
                    Tommy2k
                    wrote on last edited by
                    #9

                    Yeah that's what i have, i forgot to put it in a code tag... it's exactly what i have.

                    J 1 Reply Last reply
                    0
                    • T Tommy2k

                      Yeah that's what i have, i forgot to put it in a code tag... it's exactly what i have.

                      J Offline
                      J Offline
                      Joao Paulo Figueira
                      wrote on last edited by
                      #10

                      Where is the list contained?

                      T 1 Reply Last reply
                      0
                      • J Joao Paulo Figueira

                        Where is the list contained?

                        T Offline
                        T Offline
                        Tommy2k
                        wrote on last edited by
                        #11

                        It's contained the View...

                        J 1 Reply Last reply
                        0
                        • T Tommy2k

                          It's contained the View...

                          J Offline
                          J Offline
                          Joao Paulo Figueira
                          wrote on last edited by
                          #12

                          Please show the code for the container's message map and class declaration. I'm on MSN: joao.fig@mail.telepac.pt

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups