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. code doesnt go into mouseMove

code doesnt go into mouseMove

Scheduled Pinned Locked Moved C / C++ / MFC
debugginglearning
6 Posts 3 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    Very puzzling: I am trying to debug this (its tricky to get the mouse right over the editbox ). It doesnt go into the mouseMove. But if I position the cursor over the part of the parent dilaog which is uncovered by controls, it goes into mouseMove but then of course I'm not in the rect. It looks like the richEdit is obscuring the mouseMove somehow....

    void CImageDisplay::OnMouseMove(UINT nFlags, CPoint point)
    {
    // TODO: Add your message handler code here and/or call default
    // Get the dimensions of the static control
    CRect rect;
    m_richEdit.GetWindowRect(rect);
    ScreenToClient(rect);

    // If the mouse is over the control, display the titletip. 
    // Note: The title tip will only be displayed if the text
    // in the static control is too large for the static control
    if (rect.PtInRect(point))
    {
    	CString str;
    	m\_richEdit.GetWindowText(str);
    	m\_titleTip.Show(rect, str, 0, -1);
    }
    
    CDialog::OnMouseMove(nFlags, point);
    

    }

    Many thanks,ns

    J 1 Reply Last reply
    0
    • N ns

      Very puzzling: I am trying to debug this (its tricky to get the mouse right over the editbox ). It doesnt go into the mouseMove. But if I position the cursor over the part of the parent dilaog which is uncovered by controls, it goes into mouseMove but then of course I'm not in the rect. It looks like the richEdit is obscuring the mouseMove somehow....

      void CImageDisplay::OnMouseMove(UINT nFlags, CPoint point)
      {
      // TODO: Add your message handler code here and/or call default
      // Get the dimensions of the static control
      CRect rect;
      m_richEdit.GetWindowRect(rect);
      ScreenToClient(rect);

      // If the mouse is over the control, display the titletip. 
      // Note: The title tip will only be displayed if the text
      // in the static control is too large for the static control
      if (rect.PtInRect(point))
      {
      	CString str;
      	m\_richEdit.GetWindowText(str);
      	m\_titleTip.Show(rect, str, 0, -1);
      }
      
      CDialog::OnMouseMove(nFlags, point);
      

      }

      Many thanks,ns

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Ummm... I'd say you've got to subclass the RichEdit control and add the OnMouseMove there. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      N N 2 Replies Last reply
      0
      • J Joaquin M Lopez Munoz

        Ummm... I'd say you've got to subclass the RichEdit control and add the OnMouseMove there. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        N Offline
        N Offline
        nss
        wrote on last edited by
        #3

        Ok. Will do! Thank you!

        1 Reply Last reply
        0
        • J Joaquin M Lopez Munoz

          Ummm... I'd say you've got to subclass the RichEdit control and add the OnMouseMove there. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

          N Offline
          N Offline
          ns
          wrote on last edited by
          #4

          That worked great! I read the MAunder subclass article. Did get puzzled about one thing though............the richeditctrl had no ownerdraw property to check. ALso I didnt use SubclassDlgItem or subClassWindow() at all......just changed CRichEDitCtrl to myCRichEditCTrl in the h file. I cant see when one would ever need to use SubClassWindow() etc ...? Its the subclassdemo.asp in /miscctrl. Thanks, ns ALso --- to subclass the e ditctrl portion of the combobox, how would we get the nID? The entire combobox has an id, but what about just the editctrl part... Thanks for all the help!

          J 1 Reply Last reply
          0
          • N ns

            That worked great! I read the MAunder subclass article. Did get puzzled about one thing though............the richeditctrl had no ownerdraw property to check. ALso I didnt use SubclassDlgItem or subClassWindow() at all......just changed CRichEDitCtrl to myCRichEditCTrl in the h file. I cant see when one would ever need to use SubClassWindow() etc ...? Its the subclassdemo.asp in /miscctrl. Thanks, ns ALso --- to subclass the e ditctrl portion of the combobox, how would we get the nID? The entire combobox has an id, but what about just the editctrl part... Thanks for all the help!

            J Offline
            J Offline
            Joaquin M Lopez Munoz
            wrote on last edited by
            #5

            Well, the appwizard is doing the subclassing for you. You'd need to it by hand if, for instance, the control you're subclassing is not known to the wizard, or if you don't add a member variable attached to the control. As for your other question, seems (after googling around), that you can get hold of the edit control handle by calling GetWindow(hWndCombo, GW_CHILD), hWndCombo being the handle of the entire combobox (didn't try it myself.) After getting the handle, you can proceed with manual subcassing. Good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

            N 1 Reply Last reply
            0
            • J Joaquin M Lopez Munoz

              Well, the appwizard is doing the subclassing for you. You'd need to it by hand if, for instance, the control you're subclassing is not known to the wizard, or if you don't add a member variable attached to the control. As for your other question, seems (after googling around), that you can get hold of the edit control handle by calling GetWindow(hWndCombo, GW_CHILD), hWndCombo being the handle of the entire combobox (didn't try it myself.) After getting the handle, you can proceed with manual subcassing. Good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

              N Offline
              N Offline
              ns
              wrote on last edited by
              #6

              Thank you much!

              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