Tooltip delay

I've got a tooltip control and when the mouse enters a cell I fire a routine to set the tooltip and then display.
Problem is I cannot get the initial delay to work.

N.B. the tooltip is built on mouse enter
LVL 58
GaryAsked:
Who is Participating?
 
Jacques Bourgeois (James Burger)PresidentCommented:
I think that you do not know how to work with the Tooltip control. You do not need to display it with your code, it shows automatically when set properly.

Simply set the Tooltip control on the screen and set the delay you want in the Properties window.

When this is done, all the controls have a new tooltip property displayed in the Properties window. Type the text that you want for each of the controls.

And let it work.

When the mouse hover over a control for more than the specified delay, the text entered in the Tooltip property is automatically displayed. You have nothing to do.
0
 
GaryAuthor Commented:
I am dynamically setting the tooltip text at runtime for each row as it is hovered, it is not set at design time - so the initialdelay in the properties window is not working.
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
The tooltip in a grid is part of the DataGridView, it does not use the ToolTip control. A good demonstration of that is that you have tooltips on a DataGridView even if there is no ToolTip control on the form.

I do not think that you can control the behavior of the DataGridView as you can for the ToolTip. Although, if you set your dynamic tooltip through the CellToolTipTextNeeded as should be the case, maybe putting a delay in there might to the job.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
GaryAuthor Commented:
lol
I'm not using the datagridview's default tooltip.
I am using a tooltip control that is set programmatically (text and position) when a row is hovered (mouseenter) to provide additional information.
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
Why not use the grid tooltip functionnality. It is a lot easier to use and works quite well. Simply react to the CellToolTipTextNeeded event of the grid.
0
 
GaryAuthor Commented:
Because its useless, its plain and boring and covers the cell and nearly always ends up behind the pointer.
0
 
GaryAuthor Commented:
I've tried this with your addition of automatic delay, also tried them in the Form load (suggested somewhere else), same values are set in the properties of the control.
        ToolTip1.AutoPopDelay = 30000
        ToolTip1.InitialDelay = 20000
        ToolTip1.ReshowDelay = 10000
        ToolTip1.ShowAlways = True
        ToolTip1.AutomaticDelay = 5000

This is the code in the CellMouseEnter
If My.Settings.tooltips = 0 Then
     If e.RowIndex >= 0 Then
         Dim r As Rectangle = DataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, True)
         Dim pt As Point = New Point(r.Location.X + (r.Width / 2), r.Location.Y + (r.Height / 2))
         Dim tiptext = "My text built from column values"

         ToolTip1.Show(tiptext, DataGridView1, pt, 10000)
     End If
End If

Open in new window


Only thing that seems to work is setting the display time...
0
 
GaryAuthor Commented:
An in my stupidity I realise obviously .show will always show it immediately.
0
 
CodeCruiserCommented:
Those delays are when the tooltip is shown automatically not when you call the Show method which will show the tooltip straight away.

And you want 30/20/10 second delays?
0
 
GaryAuthor Commented:
Well at least there is a slight delay now but still cannot change it from anything but what seems to be the default 500ms
I was just putting those values in to make sure it shouldn't be showing.
0
 
GaryAuthor Commented:
Ahh it's working, stripped all the settings from the code and left them set in the properties.
Thanks, you made me see the light
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.