Esempio n. 1
0
 private void SendCedeFocusEvent(Direction direction, Selection selection)
 {
     if (null != CedeFocusEvent)
     {
         CedeFocusEventArgs args = new CedeFocusEventArgs();
         args.FieldIndex = FieldIndex;
         args.Action     = Action.None;
         args.Direction  = direction;
         args.Selection  = selection;
         CedeFocusEvent(this, args);
     }
 }
Esempio n. 2
0
        private void OnCedeFocus(Object sender, CedeFocusEventArgs e)
        {
            switch (e.Action)
            {
            case Action.Home:

                _fieldControls[0].TakeFocus(Action.Home);
                return;

            case Action.End:

                _fieldControls[FieldCount - 1].TakeFocus(Action.End);
                return;

            case Action.Trim:

                if (e.FieldIndex == 0)
                {
                    return;
                }

                _fieldControls[e.FieldIndex - 1].TakeFocus(Action.Trim);
                return;
            }

            if ((e.Direction == Direction.Reverse && e.FieldIndex == 0) ||
                (e.Direction == Direction.Forward && e.FieldIndex == (FieldCount - 1)))
            {
                return;
            }

            int fieldIndex = e.FieldIndex;

            if (e.Direction == Direction.Forward)
            {
                ++fieldIndex;
            }
            else
            {
                --fieldIndex;
            }

            _fieldControls[fieldIndex].TakeFocus(e.Direction, e.Selection);
        }