Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2007

Tip: Looking for answers? Try searching our database.

how to dynamically set tootip on listbox?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GS - 26 Dec 2007 18:42 GMT
how can I set tooTip on ToolTip1 for a listbox?
kimiraikkonen - 26 Dec 2007 18:58 GMT
On Dec 26, 8:42 pm, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
wrote:
> how can I set tooTip on ToolTip1 for a listbox?

If you're meaning associating a tooltip with a control, simple drag a
tooltip from toolbox on your project then go to your control's
properties(eg: a button) and set " eg: tooltip on tooltip 1" property
text what you want.
GS - 27 Dec 2007 06:46 GMT
actually, I already have tootip1 as created like you describe.

I was attempting to set the tootip dynamically based on the scrolling/item
selected on the listbox.

I guess that is not possible, so I just gave up and set the tag instead. the
user would have to request help on the listbox 1 to see the new dynamic help
content

> On Dec 26, 8:42 pm, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
> wrote:
[quoted text clipped - 4 lines]
> properties(eg: a button) and set " eg: tooltip on tooltip 1" property
> text what you want.
Leon Lambert - 27 Dec 2007 14:20 GMT
It should be possible to dynamically pop up specific text in your
tooltip. I did this in a small map control i did. Basically i hooked
into the mouse move event for the control you are interested in. In the
event handler i looked to see if the tooltip was active. If active i
then analyzed where the mouse was in the control. I was able then to get
the specific information about the item that was under the mouse. You
can then set the text in the tooltip and display it. Following is the
code where i set the contents of the tool tip. It is taken out of
context but hopefully gives you the idea.
ToolTip    tt = mapControl.toolTip1;
RectangleF rec = new RectangleF(x - 2,y - 2,4,4);
PointF     pt = MapToScreen(mob.x,mob.y);
if (rec.Contains(pt))
{
    tt.SetToolTip(mapControl, mob.TargetInfo());
    tt.AutomaticDelay = 0;
    tt.Active = true;
}

TargetInfo can create a pretty complex set of text. It uses a
StringBuilder to do that and you can use multiple lines of text by
Appending  \n characters.

Hope this helps
Leon Lambert

> actually, I already have tootip1 as created like you describe.
>
[quoted text clipped - 12 lines]
>> properties(eg: a button) and set " eg: tooltip on tooltip 1" property
>> text what you want.
GS - 27 Dec 2007 16:20 GMT
thank you for the example code.  I will give it a shot later after finishing
up the main functionalities.

I assume mob is the mouse object right?

> It should be possible to dynamically pop up specific text in your
> tooltip. I did this in a small map control i did. Basically i hooked
[quoted text clipped - 32 lines]
> >
> > "kimiraikkonen" <kimiraikkonen85@gmail.com> wrote in message

news:33827c63-c882-4813-b7e5-e3fda64a7ce4@p69g2000hsa.googlegroups.com...
> >> On Dec 26, 8:42 pm, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
> >> wrote:
[quoted text clipped - 3 lines]
> >> properties(eg: a button) and set " eg: tooltip on tooltip 1" property
> >> text what you want.
Leon Lambert - 28 Dec 2007 12:37 GMT
No mob actually stand for Mobile Object. These are points of interest on
my map control.

Leon Lambert

> thank you for the example code.  I will give it a shot later after finishing
> up the main functionalities.
[quoted text clipped - 49 lines]
>>>> properties(eg: a button) and set " eg: tooltip on tooltip 1" property
>>>> text what you want.
GS - 30 Dec 2007 03:15 GMT
Great. I finally got around to try out your hint. thanks to your hint..

It turns out to be real easy, nothing complicated for listbox nor textbox
controls

just add another tootip
in the control's hover event
           ToolTip tt = toolTip2;
           tt.SetToolTip(regexOptionListBox,
regexOptionListBox.Tag.ToString());
           tt.AutomaticDelay = 0;
           tt.Active = true;
for a simplified example.

To make tt context sensitive to  selected listbox , I will have to use the
selected value for setToolTip accordingly instead of the tag.

I also found  out
   ToolTip tt = toolTip2;
is critical as direct use of  toolTip2.SetToolTip(...)  is not acceptable!

> It should be possible to dynamically pop up specific text in your
> tooltip. I did this in a small map control i did. Basically i hooked
[quoted text clipped - 32 lines]
> >
> > "kimiraikkonen" <kimiraikkonen85@gmail.com> wrote in message

news:33827c63-c882-4813-b7e5-e3fda64a7ce4@p69g2000hsa.googlegroups.com...
> >> On Dec 26, 8:42 pm, "GS" <gsmsnews.microsoft.co...@msnews.Nomail.com>
> >> wrote:
[quoted text clipped - 3 lines]
> >> properties(eg: a button) and set " eg: tooltip on tooltip 1" property
> >> text what you want.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.