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. Catching OnMouseMove on CGridCtrl

Catching OnMouseMove on CGridCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 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.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    I have an SDI app (test app), where I spread an CGridCtrl ... I wonder how to catch CMyView::OnMouseMove, because I saw that this handler is never fired ... can you help me, please ?

    _ 1 Reply Last reply
    0
    • _ _Flaviu

      I have an SDI app (test app), where I spread an CGridCtrl ... I wonder how to catch CMyView::OnMouseMove, because I saw that this handler is never fired ... can you help me, please ?

      _ Offline
      _ Offline
      _Flaviu
      wrote on last edited by
      #2

      I try that:

      void CGridViewDemoView::OnMouseMove(UINT nFlags, CPoint point)
      {
      // TODO: Add your message handler code here and/or call default
      TRACE("aaaaaaaaaaaaaaaaaaaaaaaaaa\n");
      CView::OnMouseMove(nFlags, point);
      }

      Taked from here.

      J 1 Reply Last reply
      0
      • _ _Flaviu

        I try that:

        void CGridViewDemoView::OnMouseMove(UINT nFlags, CPoint point)
        {
        // TODO: Add your message handler code here and/or call default
        TRACE("aaaaaaaaaaaaaaaaaaaaaaaaaa\n");
        CView::OnMouseMove(nFlags, point);
        }

        Taked from here.

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        You probably forgot to add the corresponding entry to your message map:

        BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
        ON_WM_MOUSEMOVE()
        END_MESSAGE_MAP()

        _ 1 Reply Last reply
        0
        • J Jochen Arndt

          You probably forgot to add the corresponding entry to your message map:

          BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
          ON_WM_MOUSEMOVE()
          END_MESSAGE_MAP()

          _ Offline
          _ Offline
          _Flaviu
          wrote on last edited by
          #4

          I did that:

          BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
          //{{AFX_MSG_MAP(CGridViewDemoView)
          ON_WM_SIZE()
          ON_COMMAND(ID_TOGGLE_READONLY, OnToggleReadonly)
          ON_WM_ERASEBKGND()
          ON_WM_MOUSEMOVE()
          //}}AFX_MSG_MAP
          // Standard printing commands
          ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
          ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
          ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
          END_MESSAGE_MAP()

          J 1 Reply Last reply
          0
          • _ _Flaviu

            I did that:

            BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
            //{{AFX_MSG_MAP(CGridViewDemoView)
            ON_WM_SIZE()
            ON_COMMAND(ID_TOGGLE_READONLY, OnToggleReadonly)
            ON_WM_ERASEBKGND()
            ON_WM_MOUSEMOVE()
            //}}AFX_MSG_MAP
            // Standard printing commands
            ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
            ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
            ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
            END_MESSAGE_MAP()

            J Offline
            J Offline
            Jochen Arndt
            wrote on last edited by
            #5

            Then there are two other possible sources:

            1. The message is handled by a window that is over your view (e.g. the grid control).
            2. The mouse is captured by another window (using CWnd::SetCapture).

            For the first case you should not add the handler to the view but to the grid control (which requires modifying the sources of the grid control or deriving a new class).

            _ 1 Reply Last reply
            0
            • J Jochen Arndt

              Then there are two other possible sources:

              1. The message is handled by a window that is over your view (e.g. the grid control).
              2. The mouse is captured by another window (using CWnd::SetCapture).

              For the first case you should not add the handler to the view but to the grid control (which requires modifying the sources of the grid control or deriving a new class).

              _ Offline
              _ Offline
              _Flaviu
              wrote on last edited by
              #6

              Was the first situation, and I extended CGridCtrl in order to not mess up CGridCtrl ... Thank you.

              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