AD
Administrator
Syncfusion Team
July 27, 2004 10:29 AM UTC
How can I see this problem in our sample? I tried to use this code to see it, but could not.
this.gridControl1[2,13].CellType = "GridinCell";
//this.gridControl1[2,6].CellType = "GridinCell";
//this.gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(2, 6, 5, 8));
grid = new CellEmbeddedGrid(this.gridControl1);
grid.BackColor = Color.FromArgb(0xee, 0x7a, 0x02);
grid.RowCount = 5;
//grid.ColCount = 5;
grid.ColCount = 25;
grid[1,1].Text = "this is a 5x5 grid";
grid.ThemesEnabled = true;
//this.gridControl1[2,6].Control = grid;
this.gridControl1[2,13].Control = grid;
this.gridControl1.Controls.Add(grid);
MA
Maqsood Ahmed
July 28, 2004 02:56 AM UTC
Attached is the sample. You can try it like this:
Don''t click on child grid at first. and Scroll to extreme right. Then try to click on child Grid, It won''t get focus.
GridInCellSample_3324.zip
AD
Administrator
Syncfusion Team
July 28, 2004 05:39 AM UTC
There is an exception being thrown when you do this.
In the GridInCellRenderer.OnClick method, try making this change.
//only call baseclass if no current cell
//if(!this.activeGrid.CurrentCell.HasCurrentCell)
if(this.activeGrid == null || !this.activeGrid.CurrentCell.HasCurrentCell)
base.OnClick(rowIndex, colIndex, e);
MA
Maqsood Ahmed
July 28, 2004 05:59 AM UTC
Exception occurs when activeGrid is null. The problem I am facing is the same. That it doesn''t activate a grid :S... any suggestions??
I tried Try/catch and in catch tried base.OnClick() method. but still it acts weird sometimes.
AD
Administrator
Syncfusion Team
July 28, 2004 06:07 AM UTC
Did you make the change I suggested?
That change avoided the problem in your sample for me.
MA
Maqsood Ahmed
July 28, 2004 06:59 AM UTC
Yes, I have made these changes. There are more than one child grid, in my case. Can you please try this attached sample?
Scroll to extreme right, then try to toggle between grids.
If it works fine, Click on Main Grid and later click on first Grid, it would not get focus.
Thanx.
GridInCellSample2_7067.zip
AD
Administrator
Syncfusion Team
July 28, 2004 07:27 AM UTC
I do not get an exception, and the grid scrolls to make the parent grid cell visible, but it does not select a row. Is this the problem?
You can try forcing the row selection to something with the code below in this case.
One comment is that you will not be able to have a child grid that extends beyond the rows/columns of the parent grid. The reason is that then the GridInCell would no longer be conatinaed in any parent cell (or covered range).
protected override void OnClick(int rowIndex, int colIndex, MouseEventArgs e)
{
if(this.activeGrid == null)
{
GridStyleInfo style = this.Grid.Model[rowIndex, colIndex];
if (style.Control is CellEmbeddedGrid)
{
activeGrid = style.Control as CellEmbeddedGrid;
activeGrid.CurrentCell.MoveTo(1,1);
}
}
if( !this.activeGrid.CurrentCell.HasCurrentCell)
base.OnClick(rowIndex, colIndex, e);
}
MA
Maqsood Ahmed
July 28, 2004 07:47 AM UTC
Hi!
I have tried it with breakpoints in CellRenderer OnClick method and CellEmbeddedGrid Click and CellClick event... when it doesn''t respond it doesn''t fire these events.
Anyways, give it one more try:
1. Click on Parent Grid.
2. Click on Child Grid (Green one)
3. Scroll to Right.
4. Try to Click on Child Grid
5. Toggle between Parent and Child Grid.
It won''t enforce parent cell to get visible.
PS. I have done row selection part already... it''s just that Child Grid is not getting focus.
Bye!
AD
Administrator
Syncfusion Team
July 28, 2004 08:19 AM UTC
In your sample code, you have this.gridControl1.ColCount set to 15, but when you define the covered cell for that long child grid, you go to col 23. This will not work.
Try changing the 23 to 15 along with the previous changes to avoid the null reference exception to see if that works better.
MA
Maqsood Ahmed
July 29, 2004 02:32 AM UTC
Hello!
I have tried it doing it, but it didn''t work. But i have found out a conclusion that it doesn''t work only when I adopt Child-Parent-Child click sequence (given that Parent Cell is not visible). It works fine for all other sequences. I guess you have gotten my point. Can you help me in this regard??
Bye.
MA
Maqsood Ahmed
July 29, 2004 02:34 AM UTC
Read Child-Parent-Child as Child-Parent-(Same)Child
>Hello!
> I have tried it doing it, but it didn''t work. But i have found out a conclusion that it doesn''t work only when I adopt Child-Parent-Child click sequence (given that Parent Cell is not visible). It works fine for all other sequences. I guess you have gotten my point. Can you help me in this regard??
>Bye.
AD
Administrator
Syncfusion Team
July 29, 2004 07:10 AM UTC
Try this.
protected override void OnClick(int rowIndex, int colIndex, MouseEventArgs e)
{
base.OnClick(rowIndex, colIndex, e);
}
Now the main grid has to scroll to show the start of the top-left of the covered cell. There is no way around this. If this does not happen, then there are drawing problems at the row header for the main grid.
What I see with the above code when I click into the child is the main grid scrolls to expose the top-left cell of the covered range, and then after the scroll the child grid selects the cell under the mouse at that point (which is different than the cell under the original click as that is now scrolled off the screen). I am using version 2.0.5.1 of our libraries.