CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Popup Menu.

  1. #1
    Join Date
    Apr 1999
    Posts
    3

    Popup Menu.

    I'm looking for a way to destroy a popmenu after the mouse cursor has strayed away from the menu. An example of this behavior can be seen at MSNBC.com, when you mouse over a top menu item, a cascading menu popups up, now move the mouse away from the popup and after a second or two the popup menu disappears. MSNBC implements this in Java script code, is there away to get the same effect using WIN32?

    thanks in advance

    bill baker


  2. #2
    Join Date
    May 1999
    Posts
    44

    Re: Popup Menu.

    Problem here is to detect the mouse leaving the popup window, and then do the destruction. Check
    TrackMouseEvent(...) function (only NT says the docs...)

    Or maybe use SetCapture and in OnMouseMove check if you are outside the popup window, then ReleaseCapture and destroy menu...

    /Rob


  3. #3
    Join Date
    Apr 1999
    Posts
    3

    Re: Popup Menu.

    Thanks for the reply.
    I've tried both solutions, however TrackPopupMenu captures the mouse! Thus the main window no longer recieves mouse messages.


  4. #4
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: Popup Menu.

    In that case, how about trying to derive a class from CMenu that handles this mouse movement code?

    --
    Jason Teagle
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured