Exemplo n.º 1
0
        protected override SelectionBase CreateSelectionObject()
        {
            SourceGrid.Selection.SelectionBase selObj = base.CreateSelectionObject();

            selObj.EnableMultiSelection = false;
            selObj.FocusStyle           = SourceGrid.FocusStyle.RemoveFocusCellOnLeave;
            selObj.FocusRowLeaving     += new RowCancelEventHandler(Selection_FocusRowLeaving);

            return(selObj);
        }
        /// <summary>
        /// Select the new column.
        /// </summary>
        /// <param name="ASender">sender</param>
        /// <param name="AEventArgs">event</param>
        protected void GrdColumns_CellGotFocus(SelectionBase ASender, ChangeActivePositionEventArgs AEventArgs)
        {
            System.Int32 newcolumn;

            if (FDuringApplyOrCancel == true)
            {
                grdColumns.Selection.ResetSelection(false);
                return;
            }

            newcolumn = AEventArgs.NewFocusPosition.Column;
            AEventArgs.Cancel = false;

            if ((FSelectedColumn != -1) && (newcolumn != -1) && (newcolumn != FSelectedColumn) && (!SelectColumn(-1)))
            {
                AEventArgs.Cancel = true;
                grdColumns.Selection.SelectColumn(FSelectedColumn, true);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="ASender">sender</param>
        /// <param name="AEventArgs">event</param>
        protected void GrdColumns_CellLostFocus(SelectionBase ASender, ChangeActivePositionEventArgs AEventArgs)
        {
            System.Int32 newcolumn;
            newcolumn = AEventArgs.NewFocusPosition.Column;
            AEventArgs.Cancel = false;

            if ((FSelectedColumn != -1) && (newcolumn != -1) && (newcolumn != FSelectedColumn) && (!SelectColumn(-1)))
            {
                AEventArgs.Cancel = true;
            }
        }