Mouse movement event - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Mouse movement event

KirokeKiroke Posts: 4Member
Hi!

I got a little problem here with my code. I use the ON_WM_MOUSEMOVE message to update a POINT variable that tells me where the cursor is. So when I click on a CTreeView, I use the mouse coordinates to figure out where I just clicked. That works perfectly when I want to pop a menu with a right click. I select the item I'm on using the mouse coordinate and then pop the menu at that same mouse coord. The problem is, the mouse event is not called when a menu is open, so when I got a menu running, and that I want to click to another place, the same menu open again at the same place. This is caused by the window message system that does not call my OnMouseMove() function when a menu is active. Do you guys have any idea how I could open a menu, then open another without having to manually close the one I use with a left click?

Thx in advance
Kiroke

PS : The kind of menu im talking about is the conventional one in windows...when u select a file and click properties, for example.

Comments

  • pingpongpingpong Posts: 937Member
    I might be missing something, but if you are showing the pop up menu in your right-click handler (or WM_CONTEXTMENU handler), then why not obtain the mouse coordinates from these messages parameters directly?

    : Hi!
    :
    : I got a little problem here with my code. I use the ON_WM_MOUSEMOVE message to update a POINT variable that tells me where the cursor is. So when I click on a CTreeView, I use the mouse coordinates to figure out where I just clicked. That works perfectly when I want to pop a menu with a right click. I select the item I'm on using the mouse coordinate and then pop the menu at that same mouse coord. The problem is, the mouse event is not called when a menu is open, so when I got a menu running, and that I want to click to another place, the same menu open again at the same place. This is caused by the window message system that does not call my OnMouseMove() function when a menu is active. Do you guys have any idea how I could open a menu, then open another without having to manually close the one I use with a left click?
    :
    : Thx in advance
    : Kiroke
    :
    : PS : The kind of menu im talking about is the conventional one in windows...when u select a file and click properties, for example.
    :

  • KirokeKiroke Posts: 4Member
    Well, im using the code from another programmer and I just didnt know there were another message I could use. You see, he intercepts the message NM_RCLICK, which does not give a Point in argument.


    : I might be missing something, but if you are showing the pop up menu in your right-click handler (or WM_CONTEXTMENU handler), then why not obtain the mouse coordinates from these messages parameters directly?
    :
    : : Hi!
    : :
    : : I got a little problem here with my code. I use the ON_WM_MOUSEMOVE message to update a POINT variable that tells me where the cursor is. So when I click on a CTreeView, I use the mouse coordinates to figure out where I just clicked. That works perfectly when I want to pop a menu with a right click. I select the item I'm on using the mouse coordinate and then pop the menu at that same mouse coord. The problem is, the mouse event is not called when a menu is open, so when I got a menu running, and that I want to click to another place, the same menu open again at the same place. This is caused by the window message system that does not call my OnMouseMove() function when a menu is active. Do you guys have any idea how I could open a menu, then open another without having to manually close the one I use with a left click?
    : :
    : : Thx in advance
    : : Kiroke
    : :
    : : PS : The kind of menu im talking about is the conventional one in windows...when u select a file and click properties, for example.
    : :
    :
    :

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    [blue]You can always obtain a cursor point with 'GetCursorPos()'.[/blue]
Sign In or Register to comment.