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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. getting notifications from child controls...

getting notifications from child controls...

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 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
    Tre K Renegade
    wrote on last edited by
    #1

    Hi, I've got a dialog with a simple listbox on it and I want my dialog class to be notified when the user rightclicks on the listbox. TN061 says to add ON_NOTIFY to the message map: ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnListRightClick) and add a handler function with this prototype: afx_msg void OnListRightClick( NMHDR * pNotifyStruct, LRESULT * result ); That's what I did, but it doesn't seem to work. The handler function is never called. Anyone? Thanks, ren.

    G V 2 Replies Last reply
    0
    • T Tre K Renegade

      Hi, I've got a dialog with a simple listbox on it and I want my dialog class to be notified when the user rightclicks on the listbox. TN061 says to add ON_NOTIFY to the message map: ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnListRightClick) and add a handler function with this prototype: afx_msg void OnListRightClick( NMHDR * pNotifyStruct, LRESULT * result ); That's what I did, but it doesn't seem to work. The handler function is never called. Anyone? Thanks, ren.

      G Offline
      G Offline
      G Steudtel
      wrote on last edited by
      #2

      Hello, are you sure, that you enabled the notification of parents? And if so, is the dialog window the parent? To enable notification, you have to open your diolog resource and have a look at the proprties of your list control. The format tab has in the middle of the options a boolean value for notification. Make sure that this one is activated. Hope this helps G. Steudtel Even dwarves started small.

      T 1 Reply Last reply
      0
      • G G Steudtel

        Hello, are you sure, that you enabled the notification of parents? And if so, is the dialog window the parent? To enable notification, you have to open your diolog resource and have a look at the proprties of your list control. The format tab has in the middle of the options a boolean value for notification. Make sure that this one is activated. Hope this helps G. Steudtel Even dwarves started small.

        T Offline
        T Offline
        Tre K Renegade
        wrote on last edited by
        #3

        Thanks but no luck, The Notify property was enabled and the dialog is indeed the parent. (I checked with: m_cMyListCtrl.GetParent()->m_hWnd == this->m_hWnd )

        1 Reply Last reply
        0
        • T Tre K Renegade

          Hi, I've got a dialog with a simple listbox on it and I want my dialog class to be notified when the user rightclicks on the listbox. TN061 says to add ON_NOTIFY to the message map: ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnListRightClick) and add a handler function with this prototype: afx_msg void OnListRightClick( NMHDR * pNotifyStruct, LRESULT * result ); That's what I did, but it doesn't seem to work. The handler function is never called. Anyone? Thanks, ren.

          V Offline
          V Offline
          valikac
          wrote on last edited by
          #4

          Make sure the object ID is correct and refers to the corresponding list object. Recheck. Kuphryn

          B 1 Reply Last reply
          0
          • V valikac

            Make sure the object ID is correct and refers to the corresponding list object. Recheck. Kuphryn

            B Offline
            B Offline
            Blake Miller
            wrote on last edited by
            #5

            I have seen this 'failure to comply' before. Even after quadruple checking everything. I ended up catching the right click in the control and 'manually' posting the message to the parent. Now it works fine. A little extra work to make a derived CListBox that catches the right-click, but that is what I really needed. C++/MFC/InstallShield since 1993, breathing air since 1963

            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