Anyone,
I'm trying to add a tooltip to my ultragrid when the user hovers over a cell. My first step was to just get the tooltip to display when the user was over a cell and then I was going to check for a specific cell in the next step. I can't get the following code to work to display the cell. I have the ultraToolTipManager on the form.
My code is below. Thanks, Kris
{
// Get the cell location.
// Get a refernce to the cell.
// Make sure the mouse is over a cell.
new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("Click Button", ToolTipImage.Info, "Delete Record", DefaultableBoolean.True);
// Display the tooltip.
ultraToolTipManager.SetUltraToolTip(igrdAgentPool, tipInfo);
ultraToolTipManager.ShowToolTip(igrdAgentPool);
}
else
ultraToolTipManager.HideToolTip();
hi i have also ultra grid in vb.net and i show tooltip on it plz show the below code i have seven field
' Set tool tip on a header column. Me.UltraGrid1.DisplayLayout.Bands(0).Columns("id").Header.ToolTipText = "field contain user id ." Me.UltraGrid1.DisplayLayout.Bands(0).Columns("name").Header.ToolTipText = "field contains user name ." Me.UltraGrid1.DisplayLayout.Bands(0).Columns("fathername").Header.ToolTipText = " field contains user fathername ." Me.UltraGrid1.DisplayLayout.Bands(0).Columns("address").Header.ToolTipText = "field contains user address." Me.UltraGrid1.DisplayLayout.Bands(0).Columns("marks").Header.ToolTipText = "field contains user marks ." Me.UltraGrid1.DisplayLayout.Bands(0).Columns("rollno").Header.ToolTipText = "field contains user rollno ." Me.UltraGrid1.DisplayLayout.Bands(0).Columns("qualification").Header.ToolTipText = "field contains user qualification "
Dim row As UltraGridRow For Each row In Me.UltraGrid1.Rows 'row.ToolTipText = String.Format("Sample tool tip for {0} index row.", row.Index)
' Tool tip can be set on individual cells as well.
row.Cells(0).ToolTipText = String.Format("coloumn id for {0} index row.", row.Index) row.Cells(1).ToolTipText = String.Format("coloumn name for {0} index row.", row.Index) row.Cells(2).ToolTipText = String.Format("coloumn fathername for {0} index row.", row.Index) row.Cells(3).ToolTipText = String.Format("coloumn address for {0} index row.", row.Index) row.Cells(4).ToolTipText = String.Format("coloumn marks for {0} index row.", row.Index) row.Cells(5).ToolTipText = String.Format("coloumn rollno for {0} index row.", row.Index) row.Cells(6).ToolTipText = String.Format("coloumn qualification for {0} index row.", row.Index) Next
if u want more more help plZ see my demo code i m sure that will help u
http://ahmadkhalid44.blogspot.com/2013/05/work-on-ultra-grid.html
I guess I couldn't get my head around adding unbound columns. I add my columns before I do any work with the rows and it seems to me I'd need to duplicate each column and store the hover text into each of the cell values for that extra column and then at row initialization I'd copy that value (current cell index plus 1) back to the tool tip for the column / cell I want to display. Instead I added logic to save off the value needed on hover to a list preceded by a concatenation of the column name and the row name and the value of the cell being added to the row so that I can cycle back through that list at row initialization time to load the appropriate hover values into the tooltiptext. Seems to work well.
Thanks Mike for the idea to use the InitializeRow event and the ToolTipText. Most helpful.
Allen
I don't care about the value of the index. I'm only returning it with the result set to help me keep track of these two discrete values that need to be associated with a particular cell. As soon as I get the two cell values into their respective virtual locations, I'm done with that index value and don't ever need to see it again.
I guess I could try saving off the date value (so I'd know the colum) and the cell value and the row identifier so that I can go through each column at intializerow time and add the tool tip value based on being in that column with that value.
I'll read your post more closely when I have more time.
Thanks,
I guess what you are describing might technically be possible, but it seems like a bad idea, since you will be losing the original stored index and there's really no good reason to.
For example.. suppose I have a table with a single integer column like so:
1
2
3
If I bind this to the grid, the grid will show exactly what's in the table.
Now... I can handle InitializeRow and, based on the value of the cell (1, 2, or 3), I could set the ToolTipText on that cell.
I could also change the value of the cell. So suppose I change 1 to 10, 2 to 20, and 3 to 30.
The next time InitializeRow fires for the first row, the cell will have a 10 in it, and I have no corresponding item for 10 in my list of tooltip texts.You could get around this by checking e.ReInitialize and only setting the cell value and the ToolTip when it's false (the row is initialized for the first time). But that's not the only issue.
Another problem is... suppose I want to change the 1 into "A". I can't do that, because it's an integer column.
It seems to me that the safest thing to do is to simply hide this column and display an unbound column in the grid. The unbound column could be a string, so I can set the text to anything I want - I am not limited by the data type of the original column. Also, I don't have to worry about what happens if the value in the real data column changes. InitializeRow will fire again and update the unbound column's value and tooltip automatically.
Yes I am saying that I want to load a value into the tool tip and a different value into the cell. Maybe that is easy to do when I am running through the result set rows to create that dataset row but I don't see how since I don't have access to the cells in the row until I've created the row.
So...I thought I would store an index in the value for each cell and also create two lists, one for the cell value and one for the tool tip value keyed on that index.
At the time of row initialization, I would look at the value I'd placed in the cell and look that up in the two lists and then I'd add the tool tip value for that cell and change the value (now that I've got the tool tip added by way of the index) of that cell to what I really need the value to be (the value stored in the other list by that index).
Let's take the rainfall example again:
I've got a bunch of date columns defined and now I'm going through the actual values one state at a time and creating rows for each state. I have a rainfall amount and a calculation that was used to produce that particular rainfall amount on that date. I want to display the rainfall amount in the cell and I want to display the calculation that was used to come to that amount on hover over the cell. I need to get both values stored for each cell somehow and I don't see how to do that for the tool tip value before I've added the row - and I won't add that row until I've gone through all the rainfall amounts for each date for that state.
How do I store the rainfall amount as the cell value and the calculation used in the tool tip for the corresponding cell?
Thanks.