I want to use the Infragistics tooltips, since they offer more appearance customisation than the standard System.Windows.Forms.ToolTip. However, I am experiencing difficulties getting them to display at all.
I have tried two methods. I’ll explain them below. This code is in my grid class, which extends UltraGrid.
1. Using UltraTooltipManager
private UltraToolTipInfo tooltip;
private UltraToolTipManager m_toolTipManager;
private void SetupToolTip()
{
m_toolTipManager = new UltraToolTipManager();
m_tooltip = new UltraToolTipInfo();
m_tooltip.Appearance.FontData.Name = "Verdana";
m_tooltip.ToolTipTitleAppearance.FontData.Name = "Verdana";
m_tooltip.Enabled = DefaultableBoolean.True;
}
...
public void ShowToolTip(string titleText_, string text_)
m_tooltip.ToolTipText = text_;
m_tooltip.ToolTipTitle = titleText_;
m_toolTipManager.SetUltraToolTip(this, m_tooltip);
Point loc = Cursor.Position;
loc.Offset(16, 16);
m_toolTipManager.ShowToolTip(this, loc);
2. Using Infragistics.Win.ToolTip
private Infragistics.Win.ToolTip m_tooltip;
m_tooltip = new Infragistics.Win.ToolTip(this);
m_tooltip.TitleFont = NinePointRegularVerdanaFont.GetFont();
m_tooltip.Font = NinePointBoldVerdanaFont.GetFont();
m_tooltip.TopMost = true;
m_tooltip.Show(loc);
In both of these implementations, whenever I call ShowTooltip the tooltip just doesn’t appear. Using System.Windows.Forms.ToolTip I simply call the Show method and it works fine.
I’m stuck as to why neither of the above methods work. Does anyone have any insights?
Hi,
Are there any properties on the grid I need to set to stop it trying to display tooltips itself? (I know the grid has functionality to display tooltips if the contents of the cell don't fit in the visible width of the cell.)
if u want to disable the tooltip displayed by the entire grid then override prop,,
e.Layout.Override.TipStyleCell = TipStyle.Hide
For a particular band
e.Layout.Bands(0).Override.TipStyleCell = TipStyle.Hide
And if u want to display any customised tooltip for a particular cell can do this way
e.Layout.Rows(index).Cells(index).ToolTipText = "yOUR DESIRED TEXT"
Hope this helps you out..
Thanks for the responses.
govind999 - I neglected to explain the motivation for this. I have a number of columns which I need tooltips for - however the value I want to display in this tooltip isn't just the value in the cell. For example, I have cells containing images; the tooltip for these cells should contain explanatory text.
Matt - I've simplified my SetupToolTip() method just to try and get it working:
private void SetupToolTip(){ m_tooltip = new Infragistics.Win.ToolTip(this); // is "this" the right argument to use, given that "this" is my object extending UltraGrid?
m_tooltip.TopMost = true;}
My ShowToolTip() method is below:
public void ShowToolTip(string titleText_, string text_){ m_tooltip.ToolTipTitle = titleText_; m_tooltip.ToolTipText = text_; m_tooltip.Show(this.Parent.PointToScreen(this.Location));}
This still doesn't display my tooltip anywhere.
For your first approach, I don't think that you need to specifically call ShowToolTip if you've called SetUltraToolTip; however, given that it seems like you want precise control over showing the ToolTip, you can probably skip the SetUltraToolTip method yourself (as you likely don't need the manager since you're doing the work yourself).
As for your second approach, nothing seems wrong here. I tried this same approach using a derived .NET Button along with the Infragistics.Win.ToolTip object and the same code as you (except for the custom gets of the font) and they worked fine. I'm not sure how that method could screw this up either; have you tried this with "this.Font" just as a test? Are you sure that the cursor is on the screen? You could try "m_tooltip.Show(this.Parent.PointToScreen(this.Location));" just as a test for that aspect.
-Matt
for any infragistics controls , if the String is not enough to fit in the control , it automatically pops up ToolTip right.
I don't think we have to do this explicitly.