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. WM_MOUSELEAVE madness

WM_MOUSELEAVE madness

Scheduled Pinned Locked Moved C / C++ / MFC
csharphelptutorialquestion
5 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.
  • J Offline
    J Offline
    jfugate
    wrote on last edited by
    #1

    I'm working on putting some animated goodness into my Settlers of Catan freeware port (http://www.settlers3d.net). Specifically, I'm trying to hide player information until the mouse passes over it, at which point the player info zooms out from the right and stays there until the button gets the WM_MOUSELEAVE message and then it zooms back left. The problem is that I have a couple of owner draw buttons inside my main player info button. Whenever the mouse cursor moves over these buttons, even though it is still within the player button client area, Windows sends a WM_MOUSELEAVE message and my control zooms back to the left. I've tried commenting out all mouse-handling messages within these child owner-draw buttons to no avail. I still get the WM_MOUSELEAVE message. Anyone know how to prevent this from happening? I suspect that I'm screwed, but maybe there are some decent workarounds.

    L R 2 Replies Last reply
    0
    • J jfugate

      I'm working on putting some animated goodness into my Settlers of Catan freeware port (http://www.settlers3d.net). Specifically, I'm trying to hide player information until the mouse passes over it, at which point the player info zooms out from the right and stays there until the button gets the WM_MOUSELEAVE message and then it zooms back left. The problem is that I have a couple of owner draw buttons inside my main player info button. Whenever the mouse cursor moves over these buttons, even though it is still within the player button client area, Windows sends a WM_MOUSELEAVE message and my control zooms back to the left. I've tried commenting out all mouse-handling messages within these child owner-draw buttons to no avail. I still get the WM_MOUSELEAVE message. Anyone know how to prevent this from happening? I suspect that I'm screwed, but maybe there are some decent workarounds.

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      when u get the wm_mouseleave message cant u check to see where it is on the screen or what window its still over and decide from there?


      "... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away"
      sonork: 100.18128   8028finder.com

      J 1 Reply Last reply
      0
      • L l a u r e n

        when u get the wm_mouseleave message cant u check to see where it is on the screen or what window its still over and decide from there?


        "... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away"
        sonork: 100.18128   8028finder.com

        J Offline
        J Offline
        jfugate
        wrote on last edited by
        #3

        Yes, I can do that. The problem is that I then have to call _TrackMouseEvent again immediately to set up the mouse handler and it causes some bad flickering in the control. I might look into that a little more, though.

        1 Reply Last reply
        0
        • J jfugate

          I'm working on putting some animated goodness into my Settlers of Catan freeware port (http://www.settlers3d.net). Specifically, I'm trying to hide player information until the mouse passes over it, at which point the player info zooms out from the right and stays there until the button gets the WM_MOUSELEAVE message and then it zooms back left. The problem is that I have a couple of owner draw buttons inside my main player info button. Whenever the mouse cursor moves over these buttons, even though it is still within the player button client area, Windows sends a WM_MOUSELEAVE message and my control zooms back to the left. I've tried commenting out all mouse-handling messages within these child owner-draw buttons to no avail. I still get the WM_MOUSELEAVE message. Anyone know how to prevent this from happening? I suspect that I'm screwed, but maybe there are some decent workarounds.

          R Offline
          R Offline
          Roger Allen
          wrote on last edited by
          #4

          We had the same issue with some snapping windows done here. What we did was on the WM_MOUSELEAVE, we used the GetCursorPos() and WindowFromPoint() functions and checked who the parent of that window was. If it was the window the TrackMouseEvent was used on, we setup a new one for the button. When it leaves the button you will have to check again that its not on the parent or another child window of the parent etc... Roger Allen Sonork 100.10016 I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.

          J 1 Reply Last reply
          0
          • R Roger Allen

            We had the same issue with some snapping windows done here. What we did was on the WM_MOUSELEAVE, we used the GetCursorPos() and WindowFromPoint() functions and checked who the parent of that window was. If it was the window the TrackMouseEvent was used on, we setup a new one for the button. When it leaves the button you will have to check again that its not on the parent or another child window of the parent etc... Roger Allen Sonork 100.10016 I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.

            J Offline
            J Offline
            jfugate
            wrote on last edited by
            #5

            Yeah, thanks, that's exactly what I ended up doing last night, execpt I used GetCursorPos(), GetWindowRect(), and the PtInRect() function of CRect to check if the cursor position was inside the client rectangle. Thanks for the help. I got it to work without flicker by overriding the OnEraseBackground() method and immediately returning TRUE, which I should have done a while ago, anyway.

            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