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#
  4. Tooltip on disabled controls?

Tooltip on disabled controls?

Scheduled Pinned Locked Moved C#
csharpc++question
11 Posts 4 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
    Nilesh K
    wrote on last edited by
    #1

    Hi! Could any one suggest me how I can display tooltips for a disabled controls! It was fairly easy to implement the same in MFC but em not able to find a solution in C# :( Thanks in advance!

    - Nilesh "Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw

    S 1 Reply Last reply
    0
    • N Nilesh K

      Hi! Could any one suggest me how I can display tooltips for a disabled controls! It was fairly easy to implement the same in MFC but em not able to find a solution in C# :( Thanks in advance!

      - Nilesh "Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw

      S Offline
      S Offline
      Shajeel
      wrote on last edited by
      #2

      place another control behind the disabled control so that only when your control is disabled then mouse events go to that control, in that control's mouse move event call tooltip.settooltip for the control that is behind.

      Regards Shajeel

      N 1 Reply Last reply
      0
      • S Shajeel

        place another control behind the disabled control so that only when your control is disabled then mouse events go to that control, in that control's mouse move event call tooltip.settooltip for the control that is behind.

        Regards Shajeel

        N Offline
        N Offline
        Nilesh K
        wrote on last edited by
        #3

        Thanks! But my application is having too many controls, and having duplicate control underneath each really blots it up :( - Nilesh

        H S M 3 Replies Last reply
        0
        • N Nilesh K

          Thanks! But my application is having too many controls, and having duplicate control underneath each really blots it up :( - Nilesh

          H Offline
          H Offline
          Harini N K
          wrote on last edited by
          #4

          Hi You can add hidden control (HTML or asp:hiddenfield) as this will not disturb your UI. :)

          Harini

          1 Reply Last reply
          0
          • N Nilesh K

            Thanks! But my application is having too many controls, and having duplicate control underneath each really blots it up :( - Nilesh

            S Offline
            S Offline
            Shajeel
            wrote on last edited by
            #5

            i think a better solution will to created user controls for all controls you use, but it will be time consuming and you will have to replace all your control in your application with custom controls.

            Regards Shajeel

            N 1 Reply Last reply
            0
            • S Shajeel

              i think a better solution will to created user controls for all controls you use, but it will be time consuming and you will have to replace all your control in your application with custom controls.

              Regards Shajeel

              N Offline
              N Offline
              Nilesh K
              wrote on last edited by
              #6

              but again custom controls would also face the same problem! won't they?

              1 Reply Last reply
              0
              • N Nilesh K

                Thanks! But my application is having too many controls, and having duplicate control underneath each really blots it up :( - Nilesh

                M Offline
                M Offline
                mike montagne
                wrote on last edited by
                #7

                Yes, it should be (considered) forbidden to frivolously use resources. Documentation tells us that tootips are never displayed for disabled controls. That means the behavior is not supported by the tooltip class. You would have to write your own tooltip-like class to detect mouse-over and so forth if you wanted to override this behavior, but that would be a steep price to pay to provide a tooltip for something that isn't functional at the moment in the first place.

                N 1 Reply Last reply
                0
                • M mike montagne

                  Yes, it should be (considered) forbidden to frivolously use resources. Documentation tells us that tootips are never displayed for disabled controls. That means the behavior is not supported by the tooltip class. You would have to write your own tooltip-like class to detect mouse-over and so forth if you wanted to override this behavior, but that would be a steep price to pay to provide a tooltip for something that isn't functional at the moment in the first place.

                  N Offline
                  N Offline
                  Nilesh K
                  wrote on last edited by
                  #8

                  Was wondering if there was any workaround, similar problem is seen with MFC controls as well but there you have the pretranslatemessage which allows you to handle it by sending explict messages to tooltip controler. Is it possible to implement something similar here too:)

                  - Nilesh "Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw

                  M 1 Reply Last reply
                  0
                  • N Nilesh K

                    Was wondering if there was any workaround, similar problem is seen with MFC controls as well but there you have the pretranslatemessage which allows you to handle it by sending explict messages to tooltip controler. Is it possible to implement something similar here too:)

                    - Nilesh "Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw

                    M Offline
                    M Offline
                    mike montagne
                    wrote on last edited by
                    #9

                    I really can't tell you that, but it's a good question, particularly as the disabled state itself could be an obstruction. I mean of course, that whenever someone discovers such a workaround, there's a good chance they walked down a few difficult dead ends (as successfully as possible) to find it -- so it's a good idea to ask in case someone might have the pattern handy. If so, it might be a long shot that such a person might see your post. Still, I think I'd lean away from this. Your post in fact first gave me the idea I might try a workaround to provide an additional capacity in a control I'm working on, but then I thought no, it's not often (if ever possibly) very logical to provide tooltips to disabled controls... so (for me at least, as far as I can see), I decided to accept the default functionality, particularly considering how much effort and resource overhead might be wasted to deliver the behavior you are asking for. That said, if you want pointed in the initial directions that strike me, what you might try that might not increase resource reliance too disproportionately, is detecting the parent of your control and setting the region of your control on the parent to take a mouse hit test, sampling the mouse state to raise your own hint possibly from the parent. That even may be too wild an idea or technically challenging a project.

                    N 1 Reply Last reply
                    0
                    • M mike montagne

                      I really can't tell you that, but it's a good question, particularly as the disabled state itself could be an obstruction. I mean of course, that whenever someone discovers such a workaround, there's a good chance they walked down a few difficult dead ends (as successfully as possible) to find it -- so it's a good idea to ask in case someone might have the pattern handy. If so, it might be a long shot that such a person might see your post. Still, I think I'd lean away from this. Your post in fact first gave me the idea I might try a workaround to provide an additional capacity in a control I'm working on, but then I thought no, it's not often (if ever possibly) very logical to provide tooltips to disabled controls... so (for me at least, as far as I can see), I decided to accept the default functionality, particularly considering how much effort and resource overhead might be wasted to deliver the behavior you are asking for. That said, if you want pointed in the initial directions that strike me, what you might try that might not increase resource reliance too disproportionately, is detecting the parent of your control and setting the region of your control on the parent to take a mouse hit test, sampling the mouse state to raise your own hint possibly from the parent. That even may be too wild an idea or technically challenging a project.

                      N Offline
                      N Offline
                      Nilesh K
                      wrote on last edited by
                      #10

                      Thanks for the pointer, I too was thinking on the same line. To capture region of disabled object and set required tooltip for parent, let me give a shot at it.:) Thanks again! Nilesh

                      M 1 Reply Last reply
                      0
                      • N Nilesh K

                        Thanks for the pointer, I too was thinking on the same line. To capture region of disabled object and set required tooltip for parent, let me give a shot at it.:) Thanks again! Nilesh

                        M Offline
                        M Offline
                        mike montagne
                        wrote on last edited by
                        #11

                        Well, good luck on that. Just one other thing. If your control is composite/aggregate of course, you should be able to pull this off without too much difficulty. Otherwise, it certainly would be a boon to be able to have an inside look at the ToolTip class. Some people say some of that kind of source can be found. If you can dig it up, the behavior you want may be no more difficult than overriding a method, possibly only to eliminate the logic fork that refrains from tooltip display when controls are disabled. Personally, I think Microsoft would benefit the development community tremendously by exposing selected source (like this) to us. Instead of our present far-reaching discussion without much tangible to present to each other, dozens of people could recommend just how to override whatever method. That's how it was in Delphi and C++Builder a few years back, before Borland management made the mistake of letting .Net blow them out of the water.

                        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