Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ToolTipText on a Disabled Control. 1

Status
Not open for further replies.

rickyoswaldiow

Programmer
Jul 16, 2007
127
GB
Good morning all. Today I am working on User Guides and Documentation for my project.
When the Enabled property of a control is set to False, the ToolTipText does not display! This is most annoying, is there a way around this?
 
You can mask the control by transparent label, link its visibility with Not ctl.Enabled.

combo
 
You're suggesting I place a label over the control, set the lables Visible property to False and have the ToolTipText on said label?
 
No, set it visible and transparent (BackStyle) - will be active and not visible.

combo
 
Yes, more-or-less - although not the visibility bit, where what is being suggested the label be not visble whilst the control is enabled, and then made visible when the control is disabled rather than simply being set to False

However, as long as the label position exactly matches that of the control, that there are no borders or caption and background is transparent (although for almost all controls this latter requirement isn't really necessary) then you don't really have to worry about seting the visibility to False
 
When transparent label has Visible=True, it is not possible to access the control below, this is why I suggested to set label's Visible=False when the masked control is enabled.
Obviously, both controls should have ToolTipText set, the same or distinct if more descriptive.


combo
 
A VB form actually consist of 3 layers:

1. Non-graphical Controls layer (most controls)
2. graphical and label layer (image control, shape control, labels)
3. Form drawing surface (output of drawing methods)

As you can see, labels sit on layer 2, which means (whether visible or not) that they are always below controls on layer 1. Thus they can never mask the control below, because the control never isbelow (except in the rare circumstance that we might be concerned with a disabled Image control - we don't need to worry about Shapes as they don't have a tooltip - and we can deal with this by sending our label to the back)
 
So - just to clarify for you, rickyoswaldiow, you just need to slap a label into the same place (and size) as the control that might be disabled, and set it's tooltip to be the same as that of the control. That's it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top