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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

20840 Oct 26,2004 12:15 PM Oct 27,2004 09:47 AM Windows Forms 4
loading
Tags: GridControl
Colin Marsh
Asked On October 26, 2004 12:15 PM

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?

Administrator [Syncfusion]
Replied On October 26, 2004 12:29 PM

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.

Colin Marsh
Replied On October 27, 2004 09:24 AM

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); }

Colin Marsh
Replied On October 27, 2004 09:28 AM

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?

Administrator [Syncfusion]
Replied On October 27, 2004 09:47 AM

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.

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.

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.

;