SourceGrid.Selection.SelectionBase.OnCellLostFocus C# (CSharp) Метод

OnCellLostFocus() защищенный Метод

Fired when a cell lost the focus
protected OnCellLostFocus ( ChangeActivePositionEventArgs e ) : void
e ChangeActivePositionEventArgs
Результат void
        protected virtual void OnCellLostFocus(ChangeActivePositionEventArgs e)
        {
            if (e.Cancel)
                return;

            //This code is not necessary because when the cell receive a focus I check
            // if the grid can receive the focus using the SetFocusOnCells method.
            // The SetFocusOnCells method cause any editor to automatically close itself.
            // If I leave this code there are problem when the cell lost the focus because the entire grid lost the focus,
            // in this case the EndEdit cause the grid to receive again the focus. (this problem is expecially visible when using the grid inside a tab and you click on the second tab after set an invalid cell value inside the first tab)
            //CellContext cellLostContext = new CellContext(Grid, e.OldFocusPosition);
            ////Stop the Edit operation
            //if (cellLostContext.EndEdit(false) == false)
            //    e.Cancel = true;
            //if (e.Cancel)
            //    return;

            //evento Lost Focus
            if (CellLostFocus != null)
                CellLostFocus(this, e);
            if (e.Cancel)
                return;

            //Row/Column leaving
            //If the new Row is different from the current focus row calls a Row Leaving event
            int focusRow = ActivePosition.Row;
            if (ActivePosition.IsEmpty() == false && focusRow != e.NewFocusPosition.Row)
            {
                RowCancelEventArgs rowArgs = new RowCancelEventArgs(focusRow);
                OnFocusRowLeaving(rowArgs);
                if (rowArgs.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }
            //If the new Row is different from the current focus row calls a Row Leaving event
            int focusColumn = ActivePosition.Column;
            if (ActivePosition.IsEmpty() == false && focusColumn != e.NewFocusPosition.Column)
            {
                ColumnCancelEventArgs columnArgs = new ColumnCancelEventArgs(focusColumn);
                OnFocusColumnLeaving(columnArgs);
                if (columnArgs.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            //Change the focus cell to Empty
            m_ActivePosition = Position.Empty; //from now the cell doesn't have the focus

            //Cell Focus Left
            Grid.Controller.OnFocusLeft(new CellContext(Grid, e.OldFocusPosition), EventArgs.Empty);
        }