Click to See Complete Forum and Search --> : Disabled button


nfireman
June 5th, 2005, 07:16 AM
I need to be able to show tooltips on disabled buttons.
I've seen that no events are arriving to a button when it is disabled, why? and how can I understand in code that the mouse is hovering over a disabled button for example?

Thanks in advance!

j0nas
June 5th, 2005, 06:10 PM
I think you need to implement your own tooltip control in order support disabled controls. According to the docs, tooltip doesn't work (obviously) on disabled controls. If you implement the form's MouseMove event, you can easily detect if current mouse coordinate is within a certain control (button)bounds. But AFAIK, there is no way of displaying the tooltip window by a simple method call. In an attempt to fool the tooltip control, I tried to place a label control underneath a button, so when the button was disabled, the label's tooltip message (which was the same as the button's) would be displayed. That didn't work.

Please post a follow-up if you get around this issue.

zips
June 6th, 2005, 10:58 AM
Instead of using Button.Enabled, what about just simulating the disabled condition by using your own status bool MyButtonEnabled. Then in MyButtonEnabled.set you could change the Button.ForeColor as appropriate. And in the Button.Click you could check MyButtonEnabled before doing anything. This should allow the MouseMove and ToolTip features to remain on.