EventArgs used by the FocusColumnLeaving
Inheritance: ColumnEventArgs
Exemple #1
0
 /// <summary>
 /// Fired before a column lost the focus
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnFocusColumnLeaving(ColumnCancelEventArgs e)
 {
     if (FocusColumnLeaving != null)
     {
         FocusColumnLeaving(this, e);
     }
 }
Exemple #2
0
        /// <summary>
        /// Fired when a cell lost the focus
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnCellLostFocus(ChangeActivePositionEventArgs e)
        {
            if (e.Cancel)
            {
                return;
            }

            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);
        }