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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC MouseMove and CellToolTip

Thread ID:

Created:

Updated:

Platform:

Replies:

61632 May 30,2007 10:35 AM UTC May 31,2007 08:50 PM UTC Windows Forms 5
loading
Tags: GridControl
John H
Asked On May 30, 2007 10:35 AM UTC

Hi,
Im trying to set the CellToolTip in the MouseMove event of a GGC, but the hint never displays. If I set the CellToolTip in PrepareViewStyleInfo it works correctly, but I don't want to use that event as it fires on every paint.

Any ideas?
Thanks
John

Jeba S [Syncfusion]
Replied On May 30, 2007 11:26 AM UTC

Hi John,

You could determine row and column using the PointToRowCol method in the MouseMove event handler and then set the tooltip accordingly. Below are some code snippets.


private System.Windows.Forms.ToolTip toolTip1;
private int hooverRow = -1;
private int hooverCol = -1;
private void Form1_Load(object sender, System.EventArgs e)
{
DataTable mt= new DataTable("MyTable");
mt.Columns.Add("ProductID",typeof(int));
mt.Columns.Add("ProductName",typeof(string));
mt.Columns.Add("Description", typeof(string));

mt.Rows.Add( new Object[] {1,"Beverages","Soft drinks, Coffees, Teas, Beers, and ales"});
mt.Rows.Add( new Object[] {5,"Grains/Cereals","Breads, crackers, pasta, and cereal"});
mt.Rows.Add( new Object[] {2,"Condiments","Sweet and savory sauces, relishes, spreads, and seasonings"});
mt.Rows.Add( new Object[] {4,"Dairy Products","Cheeses,Butter,Milk "});
mt.Rows.Add( new Object[] {3,"Confections","Desserts, candies, and sweet breads "});
this.gridGroupingControl1.DataSource=mt;
// Create the ToolTip and associate with the Form container.
toolTip1=new System.Windows.Forms.ToolTip();

//initialize the tip with desired timing parameters
toolTip1.InitialDelay = 500; //half a second delay
toolTip1.ReshowDelay = 0;
this.gridGroupingControl1.TableControl.MouseMove+=new MouseEventHandler(TableControl_MouseMove);
}


private void TableControl_MouseMove(object sender, MouseEventArgs e)
{
Point pt = new Point(e.X, e.Y);
int row,col;
GridTableControl tableControl = this.gridGroupingControl1.TableControl;
tableControl.PointToRowCol(pt, out row, out col);

if (col != hooverCol || row != hooverRow && row>3 && col>0)
{
hooverCol = col;
hooverRow = row;

if (this.toolTip1 != null && this.toolTip1.Active)
this.toolTip1.Active = false;
this.toolTip1.SetToolTip(tableControl, "MyTool tip");
this.toolTip1.Active = true;
}
}


Kindly let us know if this helps.

Best Regards,

John H
Replied On May 30, 2007 04:10 PM UTC

That demo worked fine thanks, although I didn't need the seperate ToolTip I could use the tableControl.CellToolTip.

Another question for you though, is there any reason why the MouseMove might not fire? I have a situation where a GGC on a UserControl descendant that is inside your docking manager doesn't fire the MouseMove. Strange, I know.

Any thoughts?
John

Jeba S [Syncfusion]
Replied On May 31, 2007 11:28 AM UTC

Hi John,

1.although I didn't need the seperate ToolTip I could use the tableControl.CellToolTip.

Answer:
~~~~~~~
There is no way to set the CellTipText to a string except through an event, either TableControlPrepareViewStyleInfo or QueryCellStyleInfo.

Here is the code snippets:

private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
if ((e.Inner.ColIndex > 3) && (e.Inner.ColIndex < 7))
{
e.Inner.Style.CellTipText = e.Inner.Style.Text;
}


If the tip is the same for all cells in the column, you can set this in the columns Appearance object once, say in formload, or from the designer.

this.gridGroupingControl1.TableDescriptor.Columns["ColumnName"].Appearance.AnyRecordFieldCell.CellTipText = "the column tip";


But if the tip is to vary for cell to cell in the column, then you would have to do it in TableControlPrepareViewStyleInfo or in QueryCellStyleInfo.

2.Another question for you though, is there any reason why the MouseMove might not fire? I have a situation where a GGC on a UserControl descendant that is inside your docking manager doesn't fire the MouseMove. Strange, I know.

Answer:
~~~~~~~
I tried to reproduce the issue in this [http://websamples.syncfusion.com/samples/Grid.Windows/F61632/main.htm] sample. But, I was not able to reproduce the issue in this sample.

Could you please give me some more information regarding how to implement this issue in this sample?. I would really appreciate it if you could provide us a sample that exhibits this behavior. We will try analyzing it here.

Best Regards,
Jeba.

John H
Replied On May 31, 2007 12:03 PM UTC

Hi Jeba,
My MouseMove event was at the wrong level, I needed to put it at GGC.TableControl.MouseMove instead.

Would like to know the table that the mouse is over though in the MouseMove event, any ideas?

Thanks
John

haneefm [Syncfusion]
Replied On May 31, 2007 08:50 PM UTC

Hi John,

Please follow the below forum thread for more details.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=61709

Best regards,
Haneef

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

;