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. Image for the cookie policy date

ToolTips not displaying in virtual grid.

I posted this as part of another thread, but I'm putting it here as a separate issue: Since moving to a Virtual Grid implementation, Cell ToolTips have stopped working. I'm certain it is something related to the Virtual Grid because I can recompile with the old, non virtual behavior, and the tooltips show up fine. In both cases, the debugger shows that CellTipText is being set. A bit more background: I am inheriting directly from GridControl, and am overriding OnCellMouseHoverEnter and setting GridStyleInfo.CellTipText for the current cell. Here is the code, slightly simplified: override protected void OnCellMouseHoverEnter(GridCellMouseEventArgs e) { GridStyleInfo gsi = this[e.RowIndex, e.ColIndex]; CellData cd = (CellData)gsi.Tag; if( cd != null ) { string gpTipText = "Some helpful tip"; gsi.CellTipText = gpTipText; } base.OnCellMouseHoverEnter( e ); } I haven't tried it yet, but I'm speculating that perhaps it might work to set CellTipText withing QueryCellInfo...? Still, I'd rather not do that, as it adds extra overhead, and I'm trying to keep that routine as lightweight as possible in order to keep scrolling and refresh fast. Anyway, what is the preferred method for displaying tooltips unique to a given cell within a virtual grid?

7 Replies

AD Administrator Syncfusion Team October 3, 2003 06:09 PM UTC

The call to gsi.CellTipText will trigger a ChangeCells call which then results in SaveCellInfo being called. You mention that you are using a virtual grid. So, unless you now do something with the style object or CellTipText within SaveCellInfo the information will be lost. After you set e.Handled = true in SaveCellInfo the grid will not do any saving of the style object and it will be simply discarded if you don't save it yourself. There is no overhead involved in setting the CellTipText in QueryCellInfo. So, yes if you have a virtual grid I recommend QueryCellInfo to set cell tip text. Stefan


AD Administrator Syncfusion Team October 3, 2003 06:31 PM UTC

hmm... as it happens, I set a flag just before setting the tiptext and clear it after. I omitted that from the code pasted above. In OnSaveCellInfo, it checks the flag, and if present ignores all application cell saving code and just calls base.OnSaveCellInfo() with the unmodified GridSaveCellInfoEventArgs, which has Handled set to false (verified this in debugger). Thus, according to your description above, I would expect that events should be processed normally and the styleinfo saved. Except the tooltip never appears...? I will give OnQueryCellInfo a try just to ensure it works. I wasn't concerned about overhead in the Syncfusion code so much as in the application code. It generates a unique tooltip for each cell, and the generation process is slightly involved. Nothing too heavyweight, but I'd rather do it when the user is actually about to display a tooltip (ie, during mouse hover over a given cell) than for each cell at display time -- when scrolling, etc.


AD Administrator Syncfusion Team October 3, 2003 08:32 PM UTC

SaveCellInfo always comes in a pair with QueryCellInfo. So if you say you actually let the grid save the value in SaveCellInfo then be sure that QueryCellInfo does not set e.Handled = true before retrieving the data. There is one more thing. Style objects that are initialized with QueryCellInfo are cached and will only be refreshed once Garbage Collection (GC) kicks in or if ResetVolatileData is called. It's just so that when you move the mouse over the grid the QueryCellInfo for a cell will only be called now and then. If you are looking for an event that is called real time without any caching then you need to look at PrepareViewStyleInfo. The grid calls PrepareViewStyleInfo just before it needs information about a cell or just before it gets drawn and will immediately discard the object once used. So, if you set a flag in CellMouseHover, it is unlikely that QueryCellInfo is hit but PrepareViewStyleInfo will for sure be hit. Stefan


SH shashank June 29, 2007 02:14 PM UTC

hi,

I have the some what the same problem of celltiptext. I set the CellTipText in OnQueryCellInfoand the text doesnt show up and if i change the size of one of the cells by dragging it then the tip starts showing up. This means whenever i make change to the grid the information is saved and the celltip shows up.

I have tried putting it in OnPrepareViewStyleInfo too but no luck .This is what exactly do

protected override void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e)
{
e.Style.CellTipText = "Some text";
base.OnPrepareViewStyleInfo(e);
}
this is it ..I dont have anything else in OnPrepareViewStyleInfo.

Please suggest me where can I place this functionality so that i can view it properly at run time

Thanks,
Shashank

>SaveCellInfo always comes in a pair with QueryCellInfo. So if you say you actually let the grid save the value in SaveCellInfo then be sure that QueryCellInfo does not set e.Handled = true before retrieving the data.
>
>There is one more thing. Style objects that are initialized with QueryCellInfo are cached and will only be refreshed once Garbage Collection (GC) kicks in or if ResetVolatileData is called. It's just so that when you move the mouse over the grid the QueryCellInfo for a cell will only be called now and then.
>
>If you are looking for an event that is called real time without any caching then you need to look at PrepareViewStyleInfo. The grid calls PrepareViewStyleInfo just before it needs information about a cell or just before it gets drawn and will immediately discard the object once used.
>
>So, if you set a flag in CellMouseHover, it is unlikely that QueryCellInfo is hit but PrepareViewStyleInfo will for sure be hit.
>
>Stefan


HA haneefm Syncfusion Team June 29, 2007 11:09 PM UTC

Hi Shashank,

You set the style.ToolTipText for the particular cell.
//Or
You can do this in QueryCellInfo.

private void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if(e.RowIndex > 0 && e.ColIndex > 0)
e.Style.CellTipText = e.Style.FormattedText;//maybe .Text or some other string...
}

Below is a KB article that shows you "How do I display tips that vary from cell to cell in my grid?".
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=67

Also refer the below forum threads for more details.
For Tooltip properties : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=29799
For Tooltip Size : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=23741
For Tooltip Width : http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=12940

Best regards,
Haneef


SH shashank July 2, 2007 03:32 PM UTC

Hi Haneef,

As mentioned I have already tried setting
e.Style.CellTipText = e.Style.CellValue.ToString(); in OnQueryCellInfo .

The text isnt displayed initially whenever i hover my mouse on the text. But if I adjust the cell size then in such a case the changes are getting reflected and I am able to see the TipText further. So I guess when i am trying to change the size the cell properties are getting saved and i am able to see the TipText.

Please suggest if you know any resolution for this ..


HA haneefm Syncfusion Team July 2, 2007 05:45 PM UTC

Hi Shashank,

Thank you for your update.

I am not sure of what be might be causing this strange behavior without a working sample. Is it possible for you to upload us a minimal sample to reproduce the issue here? This will help us to analyse the issue further.

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon