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.

Excel like selection

Thread ID:

Created:

Updated:

Platform:

Replies:

71815 Feb 14,2008 05:13 AM Apr 11,2008 08:10 PM Windows Forms 3
loading
Tags: GridControl
John Ruiz
Asked On February 14, 2008 05:13 AM

Hi Again,

I am trying to achieve something how it is possible in excel.

If a user selects a number of records and
(1) Right clicks over the selected cells, excel then still select all the records and shows the pop up menu
(2) On right clicking outside the selected cells, excel un-select the previous selected cell, select the current row and shows the pop up menu

Can you please suggest how to do the same using Gridgroupingcontrol

I have tried using AnyRangeIntersects but gridGroupingControl.TableModel.Selections.GetSelectedRows(false, true) always return 1

Thanks


Vishnu Kumar [Syncfusion]
Replied On February 15, 2008 09:07 AM


Hi John

Thank you for your patience.

Issue 1:Right clicks over the selected cells, excel then still select all the records and shows the popup menu

Yes . It is possible to select all the record and able to show the popup menu when right clicking the mouse on the selected cells in Gridgroupingcontrol. The following code snippet is used to achieve this behavior.


gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


Issue 2: On right clicking outside the selected cells, excel un-select the previous selected cell, select the current row and shows the popup menu

No. It's not possible to deselect the selected rows by mouse right click when SelectCellsMouseButtonsMask property is set to left .Because we can set the SelectCellsMouseButtonsMask either left of right.

Please refer the sample in the below link which illustrates the above:

http://www.syncfusion.com/support/user/uploads/71815_14242cc5.zip

Please try running the above sample and let me know if this helps.

Regards,
Vishnu.




John Ruiz
Replied On February 15, 2008 10:24 AM



>
Hi John

Thank you for your patience.

Issue 1:Right clicks over the selected cells, excel then still select all the records and shows the popup menu

Yes . It is possible to select all the record and able to show the popup menu when right clicking the mouse on the selected cells in Gridgroupingcontrol. The following code snippet is used to achieve this behavior.


gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


Issue 2: On right clicking outside the selected cells, excel un-select the previous selected cell, select the current row and shows the popup menu

No. It's not possible to deselect the selected rows by mouse right click when SelectCellsMouseButtonsMask property is set to left .Because we can set the SelectCellsMouseButtonsMask either left of right.

Please refer the sample in the below link which illustrates the above:

http://www.syncfusion.com/support/user/uploads/71815_14242cc5.zip

Please try running the above sample and let me know if this helps.

Regards,
Vishnu.





If the second is not possible can't we achieve the same programmatically atleast? How about subscribing to cell click or table mosue down event? and then unselecting the selected rows when the cell is out of the selected records range? Could you tell me how to find if the selected cell is with in the selected range or records or not?

Thanks a bunch.

Cheers


haneefm [Syncfusion]
Replied On April 11, 2008 08:10 PM

Hi John,

You can handle the TableControlMouseDown event and track the GridTableCellStyleInfo for the clicked cell. Then in your event handler, you can access the TableCellIdentity for this saved style. This object has complete information for the Table which you can access through the DisplayElement.

private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.PointToTableCellStyle(pt);
Element el = style.TableCellIdentity.DisplayElement;

if(Control.MouseButton == MouseButton.Right)
{
el.ParentTable.SelectedRecords.Clear();
}
}

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.

;