473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ToolTip from within a UserControl

I am making a UserControl that is entirely taken up by Labels. I have found
a way to pass the Click even to the outside (I have the same handler for
each label.click and that raises a this.OnClick(e); )

How do I do this with whatever mystery is the ToolTip component? Since the
UserControl surface is not exposed, it will never send the ToolTip whatever
it needs to fire. I've tried the OnMouseHover() I've tried looking for the
ToolTip component in the parent and then do a GetTooltip for the UserControl
but there is no guarantee that the Tooltip will get created and initialized
first.

Thanks for the help,
Tom P.
Nov 17 '05 #1
4 10024
The easy way to handle this problem is to have your UserControl export
a ToolTop property that, when it's set, just sets the ToolTip
properties of all of its component controls. The get accessor can just
return the ToolTip from any component within the UserControl, as
they'll all be the same.

The only downside to doing it this way is that the tool tip will be
redisplayed whenever the user moves from one component to another
within the user control, so the tool tip can become annoyingly
persistent at times.

I remember someone else writing in
microsoft.public.dotnet.languages.csharp that they had solved this
problem a different way using MouseHover and timers, but I don't
remember the details. If I find that post again I'll post a link to it
here.

Nov 17 '05 #2
I don't have access to each label from the MainForm, they are private to
(obfuscated by) the UserControl.

That's the problem.

Tom P.

"blameMike" <bl*******@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
Have you tried setting the ToolTip on "toolTipControl" property for each
label?

"Henry Padilla" wrote:
I am making a UserControl that is entirely taken up by Labels. I have
found
a way to pass the Click even to the outside (I have the same handler for
each label.click and that raises a this.OnClick(e); )

How do I do this with whatever mystery is the ToolTip component? Since
the
UserControl surface is not exposed, it will never send the ToolTip
whatever
it needs to fire. I've tried the OnMouseHover() I've tried looking for
the
ToolTip component in the parent and then do a GetTooltip for the
UserControl
but there is no guarantee that the Tooltip will get created and
initialized
first.

Thanks for the help,
Tom P.

Nov 17 '05 #3
Your UserControl should not be concerned with the setting or displaying of a
tooltip. It's the job of the developer to instruct the control what text to
display when using the ToolTip component. If you want, you could always
just create a custom Hint property.

"Henry Padilla" <pa******@hotmail.com> wrote in message
news:25***************@newssvr33.news.prodigy.com. ..
I am making a UserControl that is entirely taken up by Labels. I have
found a way to pass the Click even to the outside (I have the same handler
for each label.click and that raises a this.OnClick(e); )

How do I do this with whatever mystery is the ToolTip component? Since
the UserControl surface is not exposed, it will never send the ToolTip
whatever it needs to fire. I've tried the OnMouseHover() I've tried
looking for the ToolTip component in the parent and then do a GetTooltip
for the UserControl but there is no guarantee that the Tooltip will get
created and initialized
first.

Thanks for the help,
Tom P.

Nov 17 '05 #4
True but without being able to expose the magical ToolTip event my control
will never cause a tooltip to be displayed.

I think the custom property is the way I'm going to have to go. I'll try
naming it the same as the ToolTip property and see if I can accidentally
hijack the functionality.

Tom P.
"James Swindell" <ja******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Your UserControl should not be concerned with the setting or displaying of
a tooltip. It's the job of the developer to instruct the control what
text to display when using the ToolTip component. If you want, you could
always just create a custom Hint property.

"Henry Padilla" <pa******@hotmail.com> wrote in message
news:25***************@newssvr33.news.prodigy.com. ..
I am making a UserControl that is entirely taken up by Labels. I have
found a way to pass the Click even to the outside (I have the same handler
for each label.click and that raises a this.OnClick(e); )

How do I do this with whatever mystery is the ToolTip component? Since
the UserControl surface is not exposed, it will never send the ToolTip
whatever it needs to fire. I've tried the OnMouseHover() I've tried
looking for the ToolTip component in the parent and then do a GetTooltip
for the UserControl but there is no guarantee that the Tooltip will get
created and initialized
first.

Thanks for the help,
Tom P.


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jim H | last post by:
I have a dialog that I bring up as an options dialog. I have a variable for this dialog as a member of the main application form and I create it in the constructor. I bring up the dialog by...
0
by: Brian Kitt | last post by:
I have an application that has several UserControls, and I can't seem to get ToolTips to work with them. The ToolTips work fine with Windows Controls, so I know I have them set up properly. The...
8
by: Rachel Suddeth | last post by:
I have an application where some forms have many (say 100) UserControls on them (each of which contain a label, an image, and a data entry control), and each UserControl has a ToolTip provider...
2
by: tony | last post by:
I initally posted this July 29, 05 and did not get any replies: I have a Windows Forms UserControl that runs in a thick client. I am now deploying it within an IE web page. Everything works fine,...
1
by: Sakharam Phapale | last post by:
Hi All, I have developed my own user control and created custom mouse enter event. I need to show ToolTip on mouse enter event. I have written following code for that, but it doesn't show ToolTip....
1
by: Steve | last post by:
I want to show a tooltip over one of my WinForm controls at startup. The control is part of a UserControl that I'm hosting in a CAP DeckWorkspace. In other words, I have many user controls that I...
2
by: Mark Collard | last post by:
I've noticed that when you add a ToolTip component to a Form (or UserControl) the other controls on the form display a property in the property grid called "ToolTip on toolTip1", so you can set the...
4
by: rn5a | last post by:
A DataList displays 3 columns - Product, Category & Price. These columns are populated with records from a SQL Server 2005 DB table. Apart from the above 3 DB columns that the resultset retrieves,...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.