Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Tooltip delay

Posted on 2012-09-02
12
Medium Priority
?
1,324 Views
Last Modified: 2012-09-04
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
0
Comment
Question by:Gary
  • 7
  • 3
  • 2
12 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 38359923
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
 
LVL 58

Author Comment

by:Gary
ID: 38360893
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
 
LVL 40
ID: 38361331
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 58

Author Comment

by:Gary
ID: 38361366
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
 
LVL 40
ID: 38361525
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
 
LVL 58

Author Comment

by:Gary
ID: 38361547
Because its useless, its plain and boring and covers the cell and nearly always ends up behind the pointer.
0
 
LVL 58

Author Comment

by:Gary
ID: 38365279
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
 
LVL 58

Author Comment

by:Gary
ID: 38365303
An in my stupidity I realise obviously .show will always show it immediately.
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1000 total points
ID: 38365309
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
 
LVL 58

Author Comment

by:Gary
ID: 38365318
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
 
LVL 58

Author Comment

by:Gary
ID: 38365336
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question