We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hover

Thread ID:

Created:

Updated:

Platform:

Replies:

2982 Feb 24,2003 07:03 PM UTC Feb 25,2003 01:02 PM UTC WinForms 5
loading
Tags: GridControl
Curtis Koppang
Asked On February 24, 2003 07:03 PM UTC

I implemented the code in your FAQ to do hover from the MouseMove event (this seems wrong to me, seems like it should be MouseHover). By putting Debug.WriteLines in my handler I can see that I am activating the ToolTip control, but it never shows up. Any idea why? I pasted my MouseMove and FormLoad handlers below. Tx, curt private void gridDataBoundGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { int row, col; this.gridDataBoundGrid1.PointToRowCol( new Point( e.X, e.Y), out row, out col); if ( col >= 0 && row >= 0) { int x = 14; } if ( col >= myBeginSecuritesCol && row <= 2) { if ( myToolTip.Active == true) { Debug.WriteLine( "De-activating hover"); myToolTip.Active = false; } else { Debug.WriteLine( "Activating hover"); myToolTip.SetToolTip( this.gridDataBoundGrid1, "hello from tooltip"); myToolTip.Active = true; } } } private void GreenBoxCtl_Load(object sender, System.EventArgs e) { myToolTip = new System.Windows.Forms.ToolTip(); myToolTip.InitialDelay = 500; myToolTip.ReshowDelay = 0; }

Curtis Koppang
Replied On February 24, 2003 07:44 PM UTC

I think this has something to do with the fact the the cells I want to display the tool tip on are header cells. Because if I change the target column range it does seem to work. Why would this work differently? BTW, the code you have on the FAQ has a bug. When you check if the mouse pos is in the range you are trapping, you toggle the tool tip active flag. Since it is possible to miss a mouse move (when moving very quickly) you need to also set the active flag to false when the cursor is outside the target range. I copied the corrected code below. later, curt private void gridControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { int row, col; if(this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col) && (col != hooverCol || row != hooverRow)) { hooverCol = col; hooverRow = row; if(this.toolTip1 != null && this.toolTip1.Active) this.toolTip1.Active = false; //turn it off this.toolTip1.SetToolTip(this.gridControl1, string.Format("tooltip: row {0}, column {1}", hooverRow, hooverCol)); this.toolTip1.Active = true; //make it active so it can show } else { this.toolTip1.Active = false; } }

Administrator [Syncfusion]
Replied On February 25, 2003 08:57 AM UTC

I dropped a GridDataBoundGrid into the sample from the KB. Attached is what I got. With this code, there does not seem to be a problem with getting the tooltip over headers. I might be missing something here, but I am not sure you want to add the else clause to turn off the tooltip if you are not over a different cell. The MouseMove will continue to be hit as you move the mouse over the same cell. If you turn it off on the second hit of MouseMove over the same cell, the tip cannot be displayed. The reason the MouseMove is used instead of MouseHover is that these are Control inherited events. Thus MouseHover is only fired once for teh entire grid. It is not continuously fired as you move the mouse from cell to cell. Actually, in an upcoming release, we will fire cell versions of these mouse events.

Curtis Koppang
Replied On February 25, 2003 11:55 AM UTC

In this sample I trap for the hover over the header cell which has the word Turbo in it. Yet the tool tip is never visible. Tx, curt

Administrator [Syncfusion]
Replied On February 25, 2003 12:56 PM UTC

Your zip did not appear to include TestData.xml. Could you attach it? Thanks.

Administrator [Syncfusion]
Replied On February 25, 2003 01:02 PM UTC

Now I could not try this becuase of the missing data, but I would suggest you try this code.
private bool over55 = false;
private void gridDataBoundGrid1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
	int row, col;

	this.gridDataBoundGrid1.PointToRowCol( new Point( e.X, e.Y), out row, out col);

	if ( col == 5 && row == 5 && !over55) 
	{
		if ( myToolTip.Active == true)
		{
			Debug.WriteLine( "De-activating hover");
			myToolTip.Active = false;
		}
		else
		{
			Debug.WriteLine( "Activating hover");
			myToolTip.SetToolTip( this.gridDataBoundGrid1, "hello from tooltip");
			myToolTip.Active = true;
		}
		over55 = true;
	}

	if ( col != 5 || row != 5)
		over55 = false;
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;