Results 1 to 8 of 8

Thread: ToolTip on Menu Item

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,937

    ToolTip on Menu Item

    Ok here's another I haven't tried to do before.

    I've got a nice ToolTip procedure that puts nice multi-line balloon tooltips on the screen. However, typically, I call it in MouseMove events, and it takes the hWnd of the control I'm putting it on. And I've got neither of those for a menu item.

    Actually, I'm not sure a menu item even has a hWnd. I suspect the overall dropdown list has a hWnd, but I'd need it for each item. I suppose I could make it work with the hWnd to the dropdown window, but I still need a MouseMove event.

    Hmmm, maybe I'm working this out as I type. I suppose I could parse the items on the list and do a bit of 2D geometry to figure out which one I'm hovering over. Argh, that feels messy.

    ---------

    Any ideas on this would be greatly appreciated.

    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  2. #2

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,937

    Re: ToolTip on Menu Item

    Here, I mocked up what I'd like to do:

    Name:  TooTipOnMenu.png
Views: 456
Size:  3.4 KB

    EDIT: Just FYI, that was photoshopped, not programmed.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  3. #3
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: ToolTip on Menu Item

    You might be better of with an owner drawn menu to save your time, like those that can display icons. The standard menu is windowless. You call GetMenu to get hMenu(This can be done with other apps too), then you call GetSubMenu, followed by GetMenuItemRect. You probably looking at more than 100 lines of code to do this. Not to mention subclassing.

  4. #4
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: ToolTip on Menu Item

    Found this sample that adds tooltips:

    http://www.vbforums.com/showthread.p...-to-menu-items

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,710

    Re: ToolTip on Menu Item

    Elroy I feel like we've had this discussion before...

  6. #6

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,937

    Re: ToolTip on Menu Item

    Quote Originally Posted by fafalone View Post
    Elroy I feel like we've had this discussion before...
    Hmmm, interesting. I tried turning that into a true tooltip and it's got some problems, but it's definitely something to work with. qvb6, your link also has some interesting code. I'm working some other stuff right now. But, if I get back to this and get a cleaned up version, I'll post it.

    And it's amazing how little memory I have of that other work. I certainly didn't incorporate it into anything I distributed.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: ToolTip on Menu Item

    Why would a Menu-Item not have a Handle?
    GetMenu to get the Top-Level-Menu-Handle --> https://docs.microsoft.com/en-us/win...ectedfrom=MSDN
    GetSubMenu to get the Handle to Menu-Item --> https://docs.microsoft.com/en-us/win...ser-getsubmenu
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  8. #8
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: ToolTip on Menu Item

    Couldn't edit my post:
    WOOOPSS!
    Just saw qvb6 said the same
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

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