473,379 Members | 1,278 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,379 software developers and data experts.

Invoking a tooltip from a secundary thread

Hello everybody,

Iīve got a problem thatīs slightly complicated (at least to me it
seems) so I will try to state it as clearly as possible.

At a certain point in time, I start a second thread that runs one of
my functions. The function in this second raises events. As you might
know, the eventhandler for this event is executed within this second
thread and not within the first. Itīs not possible to update
properties of a user control (like a label) that was created in the
first thread, from a second thread. Now .NET has this neat little
invoke() method on their controls, so that you can still use delegates
to update these controls.

So far so good.

However, I run into problems with one special object: a ToolTip
instance. I want the eventhandler, executed by the second thread, to
display a tooltip. However, there is no invoke() method on the
tooltip, and that makes invoking it quite hard. Calling it directly
doesnīt work either.

Does anyone have a solution for this so that I can still show this
tooltip?

Kind regards,
Thijs Brilleman
Feb 11 '08 #1
3 1708
You could :
- configure the tooltip so that it is displayed automatically when hovering
the control if applicable
- if you want to display explicitely the tool tip, you can use whatever
Invoke method is available. AFAIK having Invoke on all controls is a
convenience to avoid going always to the parent form but calling invoke on
any control that belongs to the form (or the Form.Invoke method) will always
call on the same UI thread...

--
Patrice

"Thijs" <th*************@gmail.coma écrit dans le message de news:
ab**********************************...oglegroups.com...
Hello everybody,

Iīve got a problem thatīs slightly complicated (at least to me it
seems) so I will try to state it as clearly as possible.

At a certain point in time, I start a second thread that runs one of
my functions. The function in this second raises events. As you might
know, the eventhandler for this event is executed within this second
thread and not within the first. Itīs not possible to update
properties of a user control (like a label) that was created in the
first thread, from a second thread. Now .NET has this neat little
invoke() method on their controls, so that you can still use delegates
to update these controls.

So far so good.

However, I run into problems with one special object: a ToolTip
instance. I want the eventhandler, executed by the second thread, to
display a tooltip. However, there is no invoke() method on the
tooltip, and that makes invoking it quite hard. Calling it directly
doesnīt work either.

Does anyone have a solution for this so that I can still show this
tooltip?

Kind regards,
Thijs Brilleman
Feb 11 '08 #2
Hello Thijs ,

You can just use invokerequired and if returned true use a delegate to
synchronize

i wrote some examples for this newsgroup in the past

1.
http://groups.google.nl/group/micros...f6641d3bedd548
2.
http://groups.google.nl/group/micros...2b4d3823041f08
3.
http://groups.google.nl/group/micros...6308ddc6048859
Wit the examples i show above it should be easy to acomplish what you want ,

HTH

Michel Posseth [MCP]

"Thijs" <th*************@gmail.comschreef in bericht
news:ab**********************************@m34g2000 hsf.googlegroups.com...
Hello everybody,

Iīve got a problem thatīs slightly complicated (at least to me it
seems) so I will try to state it as clearly as possible.

At a certain point in time, I start a second thread that runs one of
my functions. The function in this second raises events. As you might
know, the eventhandler for this event is executed within this second
thread and not within the first. Itīs not possible to update
properties of a user control (like a label) that was created in the
first thread, from a second thread. Now .NET has this neat little
invoke() method on their controls, so that you can still use delegates
to update these controls.

So far so good.

However, I run into problems with one special object: a ToolTip
instance. I want the eventhandler, executed by the second thread, to
display a tooltip. However, there is no invoke() method on the
tooltip, and that makes invoking it quite hard. Calling it directly
doesnīt work either.

Does anyone have a solution for this so that I can still show this
tooltip?

Kind regards,
Thijs Brilleman
Feb 11 '08 #3
Both of you, thanks a lot. The simple solution Patrice offered turned
out to be very effective.

Thijs

On Feb 11, 8:11 pm, "Michel Posseth [MCP]" <MS**@posseth.comwrote:
Hello Thijs ,

You can just use invokerequired and if returned true use a delegate to
synchronize

i wrote some examples for this newsgroup in the past

1.http://groups.google.nl/group/micros...anguages.vb/br...
2.http://groups.google.nl/group/micros...anguages.vb/br...
3.http://groups.google.nl/group/micros...anguages.vb/br....

Wit the examples i show above it should be easy to acomplish what you want,

HTH

Michel Posseth [MCP]

"Thijs" <th*************@gmail.comschreef in berichtnews:ab**********************************@m 34g2000hsf.googlegroups.com...
Hello everybody,

Iīve got a problem thatīs slightly complicated (at least to me it
seems) so I will try to state it as clearly as possible.

At a certain point in time, I start a second thread that runs one of
my functions. The function in this second raises events. As you might
know, the eventhandler for this event is executed within this second
thread and not within the first. Itīs not possible to update
properties of a user control (like a label) that was created in the
first thread, from a second thread. Now .NET has this neat little
invoke() method on their controls, so that you can still use delegates
to update these controls.

So far so good.

However, I run into problems with one special object: a ToolTip
instance. I want the eventhandler, executed by the second thread, to
display a tooltip. However, there is no invoke() method on the
tooltip, and that makes invoking it quite hard. Calling it directly
doesnīt work either.

Does anyone have a solution for this so that I can still show this
tooltip?

Kind regards,
Thijs Brilleman
Feb 12 '08 #4

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

Similar topics

1
by: Dmitry Karneyev | last post by:
Hi! How to add tooltip to a TreeView node? Thanks for any advice! Dmitry.
0
by: Yves Royer | last post by:
Hi, I'm currently writing an application (in VS 2005 bčta 2) and made some own user controls. In each user control I added a ToolTip object so i can set some tooltips on checkboxes etc. What...
0
by: Yves Royer | last post by:
Hi, My first post didn't show up so here's a second try. I'm currently writing an application (in VS 2005 bčta 2) and made some own user controls. In each user control I added a ToolTip object...
2
by: shefali | last post by:
Hi, The Tooltip text messages in my web app are not showing up in Japanese. They just show up as a string of squares in the browser... The text and errormessages display Japanese text. Here...
25
by: MuZZy | last post by:
Hi, I'm currently rewriting some functionality which was using multithredaing for retrieving datasets from database and updating a grid control. I found that the grids (Infragistics UltraGrid,...
5
by: =?Utf-8?B?cGV0ZTE5Njk=?= | last post by:
I use Visual Studio 2005 and created a very simple Form with one button. I added a Tooltip for that button. It shows fine the first time I hover over that button. But if I let it disappear by the...
3
by: Rainer Queck | last post by:
Hi NG, working on a project in VS2005 I started to add ToolTips. My problem now is, that each ToolTip only shows once. mouving the mouse over a button shows its tooltip, moving to the next...
16
by: Charles Law | last post by:
I have to take this personally now. Tooltips have been flakey since the dawn of .NET, but to still have to put up with a disappearing tooltip in VS 2008 is getting beyond a joke. Tooltips have...
8
mikek12004
by: mikek12004 | last post by:
1) Script Title: Rich HTML Balloon Tooltip 2) Script URL :http://www.dynamicdrive.com/dynamicindex5/balloontooltip.htm 3) Problem Description: See this page General Music for links you can...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.