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
close icon

Placing UI controls in the grid - controls tooltips do not show

I am placing controls in grid using the cell member "control" i.e grid1[1,1].control = somecontrol; However when the control is displayed, the tooltips do not show when you hover over the control. Even if the cell is selected, the tooltips do not show. Is there a way to make the grid not interfere with the behaviour of the control?

4 Replies

AD Administrator Syncfusion Team October 26, 2004 04:29 PM UTC

If the control is nt active, then what is seen is only a bitmap of the control, so there is no easy way to get tooltips on the control to respond to the mouse since the control is not there, only a picture of the control is in the cell. If the control has an active state, then you should be able to get its tip to show while the control has input focus. For example, this code snippet showed the tip as the textbox was active with its edit cursor visible. TextBox tb = new TextBox(); tb.BorderStyle = BorderStyle.None; this.gridControl1[2,2].CellType = "Control"; this.gridControl1[2,2].Control = tb; this.toolTip1.SetToolTip(tb, "test"); If you want to try to manage the mouse messages over a cell, then you would probably need to derive you own cell control. If you take a look at the \Grid\Samples\In Depth\DerivedCellControl sample, it is a LinkLabel cell that handles mouse moves for link hit-testing.


CM Colin Marsh October 27, 2004 01:24 PM UTC

I have written a test application to try this. I extend GridStaticCellModel and GridStaticCellRenderer. My test application puts a normal forms button in the cell and places a tooltip on it. My test app seems to work. I have one small issue. To place the button in the cell, i override OnLayout and place it in the cell there. To make it work, I had to set the celltype to "Control". This ovverrides my custom celltype of "TestButton". How do I display a custom control in the cell using the Control property but leave the celltype as "TestButton" so that its cell information is correct? e.g. protected override System.Drawing.Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, System.Drawing.Rectangle innerBounds, System.Drawing.Rectangle[] buttonsBounds) { mTheGrid[rowIndex, colIndex].Control = mCellButton; mTheGrid[rowIndex, colIndex].CellType = "Control"; return base.OnLayout (rowIndex, colIndex, style, innerBounds, buttonsBounds); }


CM Colin Marsh October 27, 2004 01:28 PM UTC

For some reason, the msg got chopped at the end of each line. The original message says: I have written a test application to try this. I extend GridStaticCellModel and GridStaticCellRenderer. My test application puts a normal forms button in the cell and places a tooltip on it. My test app seems to work. I have one small issue. To place the button in the cell, i override OnLayout and place it in the cell there. To make it work, I had to set the celltype to "Control". This ovverrides my custom celltype of "TestButton". How do I display a custom control in the cell using the Control property but leave the celltype as "TestButton" so that its cell information is correct?


AD Administrator Syncfusion Team October 27, 2004 01:47 PM UTC

I think there are problems with this approach. The CellType property determines the cell model/renderer being used. By trying to set grid[row,col].CellType inside the renderer class, it implies you do not want to use the renderer that is being used. Trying to dynamically swap CellTypes inside a renderer class is not really supported. It sounds like you want to use a Control cell. If so, did you try deriving your "TestButton" celltype from GridGenericControlCellRenderer and GridGenericControlCellModel. This way, your TestButton cell would use the style.Control just as a "Control" celltype would. You would not have to set it in the renderer itself. You would just set it like you were using a Control CellType. Now deriving from the generic celltype means you will not be able to use your celltype in more than one cell. If you need to share it across many cells, then you will have to use the techniques shown in grid\samples\CellTypes\CalendarCells (and others in that path) that override the methods so the celltype can be shared across many cells.

Loader.
Live Chat Icon For mobile
Up arrow icon