src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/UI/ColumnSelection.cs
/// <summary>
///     Switch the selection column. For multiselect, the behavior is highly dependent on the
///     the ColumnSelectionTransferAction property and the prior state of the permutation, if
///     the permutation is being reordered
/// </summary>
/// <param name="column">The new selection column</param>
/// <param name="oldPermutation">The old column permuation</param>
/// <param name="fireEvents">True if this routine should fire selection events</param>
Switch the selection column. For multiselect, the behavior is highly dependent on the
the ColumnSelectionTransferAction property and the prior state of the permutation, if
the permutation is being reordered
Switch the selection column . For multiselect the behavior is highly dependent on the the ColumnSelectionTransferAction property and the prior state of the permutation if the permutation is being reordered
private void SetSelectionColumn(int column, ColumnPermutation oldPermutation, bool fireEvents)
        {
            Debug.Assert(oldPermutation != null || column != mySelectionColumn);
            var iCaret = CurrentIndex;
            DismissLabelEdit(false, false);
            var oldColumn = mySelectionColumn;
            mySelectionColumn = column;
            if (GetStyleFlag(VTCStyleFlags.MultiSelect))
            {
                switch (myColumnSelectionAction)
                {
                    case ColumnSelectionTransferAction.PreserveNonBlankCells:
                        SetSelectionColumn_PreserveBasic(oldColumn, oldPermutation, column, false, fireEvents);
                        break;
                    case ColumnSelectionTransferAction.PreserveAnchoredCells:
                        SetSelectionColumn_PreserveBasic(oldColumn, oldPermutation, column, true, fireEvents);
                        break;
                    case ColumnSelectionTransferAction.PreserveSharedAnchors:
                        SetSelectionColumn_PreserveAnchors(oldColumn, oldPermutation, column, false, fireEvents);
                        break;
                    case ColumnSelectionTransferAction.PreserveSharedAnchorsOnly:
                        SetSelectionColumn_PreserveAnchors(oldColumn, oldPermutation, column, true, fireEvents);
                        break;
                    case ColumnSelectionTransferAction.ClearSelectedRows:
                        SetSelectionColumn_Clear(fireEvents);
                        break;
                }
            }
            else if (iCaret != -1 && fireEvents)
            {
                CurrentIndex = iCaret;
            }
            if (oldColumn != mySelectionColumn)
            {
                if (!GetStateFlag(VTCStateFlags.RestoringSelection)
                    && VirtualTreeAccEvents.ShouldNotify(VirtualTreeAccEvents.eventObjectFocus, this)
                    && Focused)
                {
                    VirtualTreeAccEvents.Notify(
                        VirtualTreeAccEvents.eventObjectFocus, CurrentIndex,
                        CurrentColumn, this);
                }
                if (HasHorizontalScrollBar)
                {
                    ScrollColumnIntoView(CurrentColumn);
                }
                if (CurrentIndex != VirtualTreeConstant.NullIndex)
                {
                    InvalidateItem(CurrentIndex, -1, NativeMethods.RedrawWindowFlags.Invalidate);
                }
            }
        }
private void SetSelectionColumn ( int column , ColumnPermutation oldPermutation , bool fireEvents ) { Debug . Assert ( oldPermutation != null || column != mySelectionColumn ) ; var iCaret = CurrentIndex ; DismissLabelEdit ( false , false ) ; var oldColumn = mySelectionColumn ; mySelectionColumn = column ; if ( GetStyleFlag ( VTCStyleFlags . MultiSelect ) ) { switch ( myColumnSelectionAction ) { case ColumnSelectionTransferAction . PreserveNonBlankCells : SetSelectionColumn_PreserveBasic ( oldColumn , oldPermutation , column , false , fireEvents ) ; break ; case ColumnSelectionTransferAction . PreserveAnchoredCells : SetSelectionColumn_PreserveBasic ( oldColumn , oldPermutation , column , true , fireEvents ) ; break ; case ColumnSelectionTransferAction . PreserveSharedAnchors : SetSelectionColumn_PreserveAnchors ( oldColumn , oldPermutation , column , false , fireEvents ) ; break ; case ColumnSelectionTransferAction . PreserveSharedAnchorsOnly : SetSelectionColumn_PreserveAnchors ( oldColumn , oldPermutation , column , true , fireEvents ) ; break ; case ColumnSelectionTransferAction . ClearSelectedRows : SetSelectionColumn_Clear ( fireEvents ) ; break ; } } else if ( iCaret != - 1 && fireEvents ) { CurrentIndex = iCaret ; } if ( oldColumn != mySelectionColumn ) { if ( ! GetStateFlag ( VTCStateFlags . RestoringSelection ) && VirtualTreeAccEvents . ShouldNotify ( VirtualTreeAccEvents . eventObjectFocus , this ) && Focused ) { VirtualTreeAccEvents . Notify ( VirtualTreeAccEvents . eventObjectFocus , CurrentIndex , CurrentColumn , this ) ; } if ( HasHorizontalScrollBar ) { ScrollColumnIntoView ( CurrentColumn ) ; } if ( CurrentIndex != VirtualTreeConstant . NullIndex ) { InvalidateItem ( CurrentIndex , - 1 , NativeMethods . RedrawWindowFlags . Invalidate ) ; } } }
Switch the selection column.
Switch the selection column .
// This may cause a focus change, because the caret moves to a different column. // ensure newly selected column is scrolled into view. // make sure we invalidate the caret item
column
int
The new selection column
The new selection column
oldPermutation
ColumnPermutation
The old column permuation
The old column permuation
fireEvents
bool
True if this routine should fire selection events
True if this routine should fire selection events