I''d like the user to be able to select arbitrary rectangular regions of the grouping grid with the mouse, and then copy that region to the clipboard. If arbitrary rect regions aren''t possible, then arb. contiguous rows will do.
What''s the setting to enable this kind of behaviour?
Also, I''d like the grid to be truly read-only; (see my previous post on this topic, currency cells don''t seem to respect the gridGroupingControl1.TableModel.ReadOnly setting!), and for no selection rect to be drawn when the users click into cells.
BUT, I''d like them to be able to COPY from _selected_ cell(s).
What''s the best way of accomplishing this?
thanks,
D.
AD
Administrator
Syncfusion Team
October 12, 2004 02:15 PM UTC
Ok, this produces good results:
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.MixRangeType |
GridSelectionFlags.Shift |
GridSelectionFlags.Keyboard |
GridSelectionFlags.Cell |
GridSelectionFlags.Row |
GridSelectionFlags.Column |
GridSelectionFlags.AlphaBlend;
But how to select columns when sorting is enabled?
>I''d like the user to be able to select arbitrary rectangular regions of the grouping grid with the mouse, and then copy that region to the clipboard. If arbitrary rect regions aren''t possible, then arb. contiguous rows will do.
>
>What''s the setting to enable this kind of behaviour?
>
>Also, I''d like the grid to be truly read-only; (see my previous post on this topic, currency cells don''t seem to respect the gridGroupingControl1.TableModel.ReadOnly setting!), and for no selection rect to be drawn when the users click into cells.
>
>BUT, I''d like them to be able to COPY from _selected_ cell(s).
>
>What''s the best way of accomplishing this?
>
>thanks,
>D.
DM
Dominic Morris
October 12, 2004 02:19 PM UTC
Tring to supress the selection rectangle and the textbox caret with:
this.gridGroupingControl1.TableDescriptor.Appearance.AnyCell.AllowEnter = false;
doesn''t produce the results I would expect, i.e. I can still "enter" a cell and get a textbox caret.
Ctrl+C does seem to copy from the selected region, though, which is good.
>Ok, this produces good results:
>
>this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.MixRangeType |
> GridSelectionFlags.Shift |
> GridSelectionFlags.Keyboard |
> GridSelectionFlags.Cell |
> GridSelectionFlags.Row |
> GridSelectionFlags.Column |
> GridSelectionFlags.AlphaBlend;
>
>
>But how to select columns when sorting is enabled?
>
>
>>I''d like the user to be able to select arbitrary rectangular regions of the grouping grid with the mouse, and then copy that region to the clipboard. If arbitrary rect regions aren''t possible, then arb. contiguous rows will do.
>>
>>What''s the setting to enable this kind of behaviour?
>>
>>Also, I''d like the grid to be truly read-only; (see my previous post on this topic, currency cells don''t seem to respect the gridGroupingControl1.TableModel.ReadOnly setting!), and for no selection rect to be drawn when the users click into cells.
>>
>>BUT, I''d like them to be able to COPY from _selected_ cell(s).
>>
>>What''s the best way of accomplishing this?
>>
>>thanks,
>>D.
AD
Administrator
Syncfusion Team
October 12, 2004 05:32 PM UTC
Hi Dominic,
you could set TableOptions.AllowSortColumn to false. This disables sorting and you can select columns. If you need sorting support you could then handle TableControlCellDoubleClick and check if it is a column header cell and then manually modify the SortedColumns collection.
Regarding the Caret, you could set the CellType to be "Static", then no editing is allowed for these cells.
Another option would be to set TableModel.Options.ActivateCurrentCellBehavior to GridCellActivateAction.None
Stefan
AD
Administrator
Syncfusion Team
October 12, 2004 05:32 PM UTC
Hi Dominic,
you could set TableOptions.AllowSortColumn to false. This disables sorting and you can select columns. If you need sorting support you could then handle TableControlCellDoubleClick and check if it is a column header cell and then manually modify the SortedColumns collection.
Regarding the Caret, you could set the CellType to be "Static", then no editing is allowed for these cells.
Another option would be to set TableModel.Options.ActivateCurrentCellBehavior to GridCellActivateAction.None
Stefan
AD
Administrator
Syncfusion Team
October 13, 2004 07:59 AM UTC
Hi Stefan,
I''ve set AllowSortColumns to false, but this still doesn''t allow the columns to be selected.
I edited GridGroupingTutorial\Project1 and added this line into the ctor:
this.gridGroupingControl1.TableOptions.AllowSortColumns = false;
Note that the grid still doesn''t allow column selection.
What am I missing??
thanks,
D.
>Hi Dominic,
>
>you could set TableOptions.AllowSortColumn to false. This disables sorting and you can select columns. If you need sorting support you could then handle TableControlCellDoubleClick and check if it is a column header cell and then manually modify the SortedColumns collection.
>
>Regarding the Caret, you could set the CellType to be "Static", then no editing is allowed for these cells.
>
>Another option would be to set TableModel.Options.ActivateCurrentCellBehavior to GridCellActivateAction.None
>
>Stefan
>
AD
Administrator
Syncfusion Team
October 13, 2004 08:01 AM UTC
Indeed, I can''t see that any of the Grouping demos show column selection!
>Hi Stefan,
>
>I''ve set AllowSortColumns to false, but this still doesn''t allow the columns to be selected.
>
>I edited GridGroupingTutorial\Project1 and added this line into the ctor:
>
> this.gridGroupingControl1.TableOptions.AllowSortColumns = false;
>
>
>Note that the grid still doesn''t allow column selection.
>
>What am I missing??
>
>thanks,
>D.
>
>>Hi Dominic,
>>
>>you could set TableOptions.AllowSortColumn to false. This disables sorting and you can select columns. If you need sorting support you could then handle TableControlCellDoubleClick and check if it is a column header cell and then manually modify the SortedColumns collection.
>>
>>Regarding the Caret, you could set the CellType to be "Static", then no editing is allowed for these cells.
>>
>>Another option would be to set TableModel.Options.ActivateCurrentCellBehavior to GridCellActivateAction.None
>>
>>Stefan
>>
AD
Administrator
Syncfusion Team
October 14, 2004 08:05 AM UTC
Hi,
the selection mechanism that comes with AllowSelection is the selection mechanism from the underlying GridControl. It is not a perfect match and we are actually going to replace it with a different mechanism for record selection in the next release.
However, for cells and column based selection you will still have to continue to use that until we also re-work the cell and column based selection.
Some work needs to be done here to better support selections and make the selection mechanism be aware of Column Descriptors, Grouped columns, captions etc. That is what the GridControl mechanism is lacking and that''s why it is difficult to get column selection working.
For now, what you can do is in the GroupCustomers example add the following lines:
this.groupingGrid1.TableOptions.AllowDragColumns = false;
this.groupingGrid1.TableOptions.AllowSortColumns = false;
this.groupingGrid1.TableOptions.AllowSelection = GridSelectionFlags.Any;
this.groupingGrid1.TableModel.SelectionChanging += new GridSelectionChangingEventHandler(TableModel_SelectionChanging);
this.groupingGrid1.TopLevelGroupOptions.ShowCaption = false;
this.groupingGrid1.TableControlCellHitTest += new GridTableControlCellHitTestEventHandler(groupingGrid1_TableControlCellHitTest);
and these handlers:
private void groupingGrid1_TableControlCellHitTest(object sender, GridTableControlCellHitTestEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
)
{
e.Inner.Cancel = true;
e.Inner.Result = 0;
}
}
private void TableModel_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
GridTableCellStyleInfo style = ((GridTableModel) sender)[e.ClickRange.Top, e.ClickRange.Left];
if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
)
{
e.Range = GridRangeInfo.Cols(e.Range.Left, e.Range.Right);
}
}
Stefan
DM
Dominic Morris
October 14, 2004 09:41 AM UTC
Thanks, I''ll give that a try.
>Hi,
>
>the selection mechanism that comes with AllowSelection is the selection mechanism from the underlying GridControl. It is not a perfect match and we are actually going to replace it with a different mechanism for record selection in the next release.
>
>However, for cells and column based selection you will still have to continue to use that until we also re-work the cell and column based selection.
>
>Some work needs to be done here to better support selections and make the selection mechanism be aware of Column Descriptors, Grouped columns, captions etc. That is what the GridControl mechanism is lacking and that''s why it is difficult to get column selection working.
>
>For now, what you can do is in the GroupCustomers example add the following lines:
>
>
> this.groupingGrid1.TableOptions.AllowDragColumns = false;
> this.groupingGrid1.TableOptions.AllowSortColumns = false;
> this.groupingGrid1.TableOptions.AllowSelection = GridSelectionFlags.Any;
> this.groupingGrid1.TableModel.SelectionChanging += new GridSelectionChangingEventHandler(TableModel_SelectionChanging);
> this.groupingGrid1.TopLevelGroupOptions.ShowCaption = false;
> this.groupingGrid1.TableControlCellHitTest += new GridTableControlCellHitTestEventHandler(groupingGrid1_TableControlCellHitTest);
>
>
>and these handlers:
>
>
> private void groupingGrid1_TableControlCellHitTest(object sender, GridTableControlCellHitTestEventArgs e)
> {
> GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
> if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
> )
> {
> e.Inner.Cancel = true;
> e.Inner.Result = 0;
> }
> }
>
> private void TableModel_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
> {
> GridTableCellStyleInfo style = ((GridTableModel) sender)[e.ClickRange.Top, e.ClickRange.Left];
> if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
> )
> {
> e.Range = GridRangeInfo.Cols(e.Range.Left, e.Range.Right);
> }
> }
>
>
>
>
>
>
>Stefan
DM
Dominic Morris
October 14, 2004 09:51 AM UTC
Yes, I''ve tried that and it isn''t perfect; sometimes need to click several times on a column header in order to get the entire column to become selected.
It also conflicts with column sorting, which is a shame.
Maybe in your next release you should make the arrow that appears on sorted column headers more like a button, so that clicking on the arrow produces sorting, but clicking elsewhere on the column header produces column selection. A contxt menu on the column header would be cool aswell:
"Sort Ascending"
"Sort Descending"
"Remove Sort"
D.
>Thanks, I''ll give that a try.
>
>>Hi,
>>
>>the selection mechanism that comes with AllowSelection is the selection mechanism from the underlying GridControl. It is not a perfect match and we are actually going to replace it with a different mechanism for record selection in the next release.
>>
>>However, for cells and column based selection you will still have to continue to use that until we also re-work the cell and column based selection.
>>
>>Some work needs to be done here to better support selections and make the selection mechanism be aware of Column Descriptors, Grouped columns, captions etc. That is what the GridControl mechanism is lacking and that''s why it is difficult to get column selection working.
>>
>>For now, what you can do is in the GroupCustomers example add the following lines:
>>
>>
>> this.groupingGrid1.TableOptions.AllowDragColumns = false;
>> this.groupingGrid1.TableOptions.AllowSortColumns = false;
>> this.groupingGrid1.TableOptions.AllowSelection = GridSelectionFlags.Any;
>> this.groupingGrid1.TableModel.SelectionChanging += new GridSelectionChangingEventHandler(TableModel_SelectionChanging);
>> this.groupingGrid1.TopLevelGroupOptions.ShowCaption = false;
>> this.groupingGrid1.TableControlCellHitTest += new GridTableControlCellHitTestEventHandler(groupingGrid1_TableControlCellHitTest);
>>
>>
>>and these handlers:
>>
>>
>> private void groupingGrid1_TableControlCellHitTest(object sender, GridTableControlCellHitTestEventArgs e)
>> {
>> GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
>> if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
>> )
>> {
>> e.Inner.Cancel = true;
>> e.Inner.Result = 0;
>> }
>> }
>>
>> private void TableModel_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
>> {
>> GridTableCellStyleInfo style = ((GridTableModel) sender)[e.ClickRange.Top, e.ClickRange.Left];
>> if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell
>> )
>> {
>> e.Range = GridRangeInfo.Cols(e.Range.Left, e.Range.Right);
>> }
>> }
>>
>>
>>
>>
>>
>>
>>Stefan