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. C / C++ / MFC
  4. CWnd::OnRButtonUp( )

CWnd::OnRButtonUp( )

Scheduled Pinned Locked Moved C / C++ / MFC
csharpcssdebuggingtutorialquestion
3 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.
  • L Offline
    L Offline
    LeeeNN
    wrote on last edited by
    #1

    I down a example (gridctrl_demo225) to study. in the code one thing puzzled me. platform : VC.Net a CGridCtrl based on CWnd, a Dialog(CDlgA) is the parent of the CGridCtrl instance. following is a part of the code // EFW - Added to forward right click to parent so that a context // menu can be shown without deriving a new grid class. void CGridCtrl::OnRButtonUp(UINT nFlags, CPoint point) { CWnd::OnRButtonUp(nFlags, point); // !!!this call trigers CDlgA::OnContextMenu(...) : : } I read document of CWnd::OnRButtonUp(nFlags, point), it does not say, it will triger parent's OnContextMenu. so if I say CWnd::OnRButtonUp(nFlags, point) calls parent's OnContextMenu(...). Is it right? And the weird thing is I set a breakpoint in CDlgA::OnContextMenu(...) want to see who calls it. There is no records of callstack.

    M 1 Reply Last reply
    0
    • L LeeeNN

      I down a example (gridctrl_demo225) to study. in the code one thing puzzled me. platform : VC.Net a CGridCtrl based on CWnd, a Dialog(CDlgA) is the parent of the CGridCtrl instance. following is a part of the code // EFW - Added to forward right click to parent so that a context // menu can be shown without deriving a new grid class. void CGridCtrl::OnRButtonUp(UINT nFlags, CPoint point) { CWnd::OnRButtonUp(nFlags, point); // !!!this call trigers CDlgA::OnContextMenu(...) : : } I read document of CWnd::OnRButtonUp(nFlags, point), it does not say, it will triger parent's OnContextMenu. so if I say CWnd::OnRButtonUp(nFlags, point) calls parent's OnContextMenu(...). Is it right? And the weird thing is I set a breakpoint in CDlgA::OnContextMenu(...) want to see who calls it. There is no records of callstack.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You shouldn't handle WM_RBUTTONUP if you want the default context menu handling, because the default window proc will send a WM_CONTEXTMENU when it sees WM_RBUTTONUP. If you do context menu handling in response to WM_RBUTTONUP, the user won't be able to bring up the context menu using the keyboard.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

      L 1 Reply Last reply
      0
      • M Michael Dunn

        You shouldn't handle WM_RBUTTONUP if you want the default context menu handling, because the default window proc will send a WM_CONTEXTMENU when it sees WM_RBUTTONUP. If you do context menu handling in response to WM_RBUTTONUP, the user won't be able to bring up the context menu using the keyboard.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        L Offline
        L Offline
        LeeeNN
        wrote on last edited by
        #3

        in CGridCtrl::OnRButtonUp() it calls base class's CWnd::OnRButtonUp() so My DlgA::OnContextMenu() was called. I want do same thing for my View. But why MyView::OnContextMenu() won't be called. MyView is CGridCtrl's parent. same as DlgA

        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