In the Grid Grouping Control 4.3 I'm starting a drag drop operation with the TableControl_Mousedown event. The event code evaluates the row and decides if the row is draggable. This is working perfectly AS LONG AS THE HORIZONTAL SCROLL BAR IS POSITIONED ALL THE WAY TO THE LEFT. If the bar is scrolled to the right the event is not properly detecting the mouse coordinates. Same behaviour in a drop operation.
Any insight would be greatly appreciated.
Thanks,
George.
HA
haneefm
Syncfusion Team
April 3, 2007 03:41 PM UTC
Hi George,
You can handle the TableControlMouseDown event and track the cell identity using the PointToRowCol method. You can try this.
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
int row, col;
if(e.TableControl.PointToRowCol(new Point(e.Inner.X, e.Inner.Y), out row, out col))
{
MessageBox.Show( String.Format("Clicked on ({0],{1}) position",row,col));
}
}
Best regards,
Haneef
GT
George Thomas
April 3, 2007 06:19 PM UTC
Thanks Haneef,
Yes the row col position stays consistent no matter where the horizontal scroll bar is. However, the GridTableCellType is effected. When you mouse down on a RecordRowHeaderCell with the horizontal scroll bar not to the extreme left
GridTableCellStyleInfo style = tableControl.PointToTableCellStyle(pt);
the style.TableCellIdentity.TableCellType returned is "AnyCell" and NOT a "RecordRowHeaderCell".
Something is going on with the scrollbar I think.
Thanks,
George.
HA
haneefm
Syncfusion Team
April 3, 2007 09:01 PM UTC
Hi George,
Please try the attached sample and let me know if this helps.
GGC_MouseDownEvent.zipBest regards,
Haneef
GT
George Thomas
April 4, 2007 02:13 PM UTC
Haneef,
I took your code and altered it to illustrate how in a nested table when the horizontal scroll bar is not flush to the left the mouse down doesnt recognize the cell type properly.
See atttachment.
George.
Form115.zip
HA
haneefm
Syncfusion Team
April 4, 2007 09:30 PM UTC
Hi George,
You can use the GetTableViewStyleInfo method to get the nested table cell information of the grid. Here is a code snippet
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
int row,col;
if( e.TableControl.PointToRowCol(pt,out row,out col))
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(row,col);
this.label1.Text = style.TableCellIdentity.TableCellType.ToString ();
}
}
Best Regards,
Haneef
GT
George Thomas
April 10, 2007 02:40 PM UTC
Haneef,
Sorry for not replying earlier...been out.
I tried your code...see the attachment...it detects a cell type of EmptyCell or NestedTableCell when the horizontal scroll bar is not flush.
So this isn't a real solution.
Thanks,
George.
Form116.zip
HA
haneefm
Syncfusion Team
April 11, 2007 08:40 PM UTC
Hi George,
You can try this code.
public GridTableCellStyleInfo GetViewStyleInfo( Point pt, GridTableControl tc )
{
GridTableCellStyleInfo style = tc.PointToTableCellStyle(pt);
if( style != null)
{
if( style.TableCellIdentity.TableCellType == GridTableCellType.AnyCell )
{
int row,col;
tc.PointToRowCol(pt,out row,out col);
style = tc.GetTableViewStyleInfo(row,col);
}
}
return style;
}
Best regards,
Haneef