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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Extending selection with shift-arrow in grouping grid

Thread ID:

Created:

Updated:

Platform:

Replies:

33597 Aug 23,2005 10:27 AM UTC Aug 24,2005 07:34 AM UTC WinForms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 23, 2005 10:27 AM UTC

The grouping grid does not support this whereas the ordinary grid control does. Do you think it would be easy to implement this behaviour for the grouping grid (e.g. by listening to a keypress event and changing the selection from code) If so could you provide a simple example on how to do it? I need it to work for a grouped grid, but not for a hierachical grid. (v3.2.1.0) Thanks in advance.

Administrator [Syncfusion]
Replied On August 23, 2005 10:57 AM UTC

If you use the special record selection support in GridGroupingControl by settingthese properties, then you can shift select records across groups. this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;

Administrator [Syncfusion]
Replied On August 23, 2005 11:16 AM UTC

I am using AllowSelection = GridSelectionFlags.Any; ListBoxSelectionMode = SelectionMode.None; (To enable block wise selection and copy) Do you thing the shift-arrow selection can be implemented in this case?

Administrator [Syncfusion]
Replied On August 23, 2005 12:00 PM UTC

You can try using this event. I am sure you will have to spend some time cleaning this up to handle the cases you wnat to handle.
int startRow, startCol;
private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = e.TableControl.CurrentCell;
		
	if(Control.MouseButtons == MouseButtons.None
		&& 0 != (Control.ModifierKeys & Keys.Shift))
	{
		GridRangeInfo r1 = GridRangeInfo.Cell(startRow, startCol);
		GridRangeInfo r2 = GridRangeInfo.Cell(cc.MoveToRowIndex, cc.MoveToColIndex);
		r2 = r2.UnionRange(r1);
		e.TableControl.Model.Selections.Clear();
		e.TableControl.Model.Selections.Ranges.Add(r2);
		e.TableControl.InvalidateRange(r2);
	}
	else
	{
		startRow = cc.RowIndex;
		startCol = cc.ColIndex;
	}
}

Administrator [Syncfusion]
Replied On August 23, 2005 02:22 PM UTC

This is working really well. I added a condition that handles row selections, apart from that I haven''t noticed any problems. This was really helpful, thanks a lot, Clay. Another question I have been wondering about: Would it be possible to highlight the row under the mouse pointer? This would make it visually easy to follow the data along a row. Maybe it could be done by handling the mouse move event and selecting the row under mouse? (This must not change the current record and should only be done if there were no selections already). If you think this is not too difucult and could provide an example, it would be great.

Administrator [Syncfusion]
Replied On August 23, 2005 02:52 PM UTC

Here is a forum post that does something similar. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=33360

Administrator [Syncfusion]
Replied On August 24, 2005 07:34 AM UTC

Works great. Thanks!

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;