Tool Tip for disabled control

R

Rachel Suddeth

I didn't know what to put for a subject, so I just tell you a problem
requirement they want for my ap. If the user hovers over a disabled control,
they want a text bubble to explain why it's disabled. (This does not seem
unreasonable. There are tool tip bubbles coming up on the disabled toolbar
buttons on my email reader right now.)

Now the ToolTipProvider will not show a tip on a disabled control. Okay I
don't mind programming my own, but you don't get any events to react to
from a disabled control (do you? just one?) So how am I supposed to know
when to show this text? I'm trying to fake out being disabled by having a
usercontrol with a "fake disabled" property that will disable all the child
controls, but the UserControl can still receive events. This is not great,
though -- anyone know of any other way?

The problem with this UserControl fake is, well...
I don't want to respond to most events when it's disabled. I just want a
"mouse hover" or enter/leave or something.) For everything else, I have to
put "if (!fake_disabled)" around the whole thing. (This is a big deal
because pretty much all the controls we will use are of this nature, and
we're talking many many textboxes and checkboxes and buttons on many many
forms. That's thousands of events with this extra line of code we have to
type in every one.) Is there any possible way I could do something in the
UserControl to avoid dealing with all those events I don't want to respond
to when fake_disabled, and only allow the one I do want?

Thanks if you have any help at all...
-Rachel
 
L

Lee Alexander

When a control is disabled no mouse or keyboard input is passed to the
window. Instead if the window is a child then message is sent to the parent.
So you can catch the fact that the mouse is over a disabled control in the
parent (Form) and handle tips manually knowing that.

Regards
Lee Alexander
..
 
R

Rachel Suddeth

Thanks!
Isn't it funny, all the time I struggled with how to do this, and just this
morning I was thinking the same thing... ToolTipProvider is attached to
container, not the control, and you could use something like a MouseMove on
the container. How obvious it seems now, but I never saw it until today.

Typically, these things will actually be on tab pages (not my idea), so I'm
thinking we'll really have to use TabControl mouse events (not sure -- I'm
still confused about where events start, when they bubble up and when they
don't...) maybe build a custom tool tip provider and attach it to a base
TabControl that we'll always use...

Well, I will read up on providers before I ask more questions :)

-Rachel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top