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.

GG Control: Horizontal Scrolling and Mouse Position

Thread ID:

Created:

Updated:

Platform:

Replies:

59021 Apr 3,2007 10:37 AM Apr 11,2007 04:40 PM Windows Forms 7
loading
Tags: GridControl
George Thomas
Asked On April 3, 2007 10:37 AM

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.



haneefm [Syncfusion]
Replied On April 3, 2007 11:41 AM

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

George Thomas
Replied On April 3, 2007 02:19 PM

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.

haneefm [Syncfusion]
Replied On April 3, 2007 05:01 PM

Hi George,

Please try the attached sample and let me know if this helps.
GGC_MouseDownEvent.zip

Best regards,
Haneef

George Thomas
Replied On April 4, 2007 10:13 AM

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

haneefm [Syncfusion]
Replied On April 4, 2007 05:30 PM

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

George Thomas
Replied On April 10, 2007 10:40 AM

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

haneefm [Syncfusion]
Replied On April 11, 2007 04:40 PM

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

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.

;