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
        protected override void OnTextChanged(EventArgs e)
        {
            base.OnTextChanged(e);

            if (!Blank)
            {
                int val;
                if (!Int32.TryParse(Text, out val))
                {
                    Text = String.Empty;
                }
                else
                {
                    if (val > RangeUpper)
                    {
                        Text = RangeUpper.ToString(CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        Text = val.ToString(CultureInfo.InvariantCulture);
                    }
                }
            }

            SelectionStart = this.TextLength;

            if (null != TextChangedEvent)
            {
                TextChangedEventArgs args = new TextChangedEventArgs();
                args.FieldId = FieldId;
                args.Text    = Text;
                TextChangedEvent(this, args);
            }

            if (Text.Length == MaxLength && Focused)
            {
                if (null != CedeFocusEvent)
                {
                    CedeFocusEventArgs args = new CedeFocusEventArgs();
                    args.FieldId   = FieldId;
                    args.Direction = Direction.Forward;
                    args.Selection = Selection.All;
                    CedeFocusEvent(this, args);
                }
            }
        }
        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);
        }
Esempio n. 4
0
        private void OnCedeFocus(Object sender, CedeFocusEventArgs e)
        {
            if ((e.Direction == Direction.Reverse && e.FieldId == 0) ||
                (e.Direction == Direction.Forward && e.FieldId == (NumberOfFields - 1)))
            {
                return;
            }

            int fieldId = e.FieldId;

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

            _fieldControls[fieldId].TakeFocus(e.Direction, e.Selection);
        }
Esempio n. 5
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 );
        }
 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);
       }
 }
 private void SendCedeFocusEvent(Action action)
 {
     if (null != CedeFocusEvent)
       {
     CedeFocusEventArgs args = new CedeFocusEventArgs();
     args.FieldIndex = FieldIndex;
     args.Action = action;
     CedeFocusEvent(this, args);
       }
 }
      private void OnCedeFocus( Object sender, CedeFocusEventArgs e )
      {
         if ( ( e.Direction == Direction.Reverse && e.FieldId == 0 ) ||
              ( e.Direction == Direction.Forward && e.FieldId == ( NumberOfFields - 1 ) ) )
         {
            return;
         }

         int fieldId = e.FieldId;

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

         _fieldControls[fieldId].TakeFocus( e.Direction, e.Selection );
      }
Esempio n. 9
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);

            _invalidKeyDown = false;

            if (!NumericKeyDown(e))
            {
                if (!ValidKeyDown(e))
                {
                    _invalidKeyDown = true;
                }
            }

            if ((e.KeyCode == Keys.OemPeriod ||
                 e.KeyCode == Keys.Decimal ||
                 e.KeyCode == Keys.Space) &&
                TextLength != 0 &&
                SelectionLength == 0 &&
                SelectionStart != 0)
            {
                if (null != CedeFocusEvent)
                {
                    CedeFocusEventArgs args = new CedeFocusEventArgs();
                    args.FieldId   = FieldId;
                    args.Direction = Direction.Forward;
                    args.Selection = Selection.All;
                    CedeFocusEvent(this, args);
                }
            }

            if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Up)
            {
                if (e.Modifiers == Keys.Control)
                {
                    if (null != CedeFocusEvent)
                    {
                        CedeFocusEventArgs args = new CedeFocusEventArgs();
                        args.FieldId   = FieldId;
                        args.Direction = Direction.Reverse;
                        args.Selection = Selection.All;
                        CedeFocusEvent(this, args);
                    }
                }
                else
                if (SelectionLength == 0 && SelectionStart == 0)
                {
                    if (null != CedeFocusEvent)
                    {
                        CedeFocusEventArgs args = new CedeFocusEventArgs();
                        args.FieldId   = FieldId;
                        args.Direction = Direction.Reverse;
                        args.Selection = Selection.None;
                        CedeFocusEvent(this, args);
                    }
                }
            }

            if (e.KeyCode == Keys.Right || e.KeyCode == Keys.Down)
            {
                if (e.Modifiers == Keys.Control)
                {
                    if (null != CedeFocusEvent)
                    {
                        CedeFocusEventArgs args = new CedeFocusEventArgs();
                        args.FieldId   = FieldId;
                        args.Direction = Direction.Forward;
                        args.Selection = Selection.All;
                        CedeFocusEvent(this, args);
                    }
                }
                else
                if (SelectionLength == 0 && SelectionStart == Text.Length)
                {
                    if (null != CedeFocusEvent)
                    {
                        CedeFocusEventArgs args = new CedeFocusEventArgs();
                        args.FieldId   = FieldId;
                        args.Direction = Direction.Forward;
                        args.Selection = Selection.None;
                        CedeFocusEvent(this, args);
                    }
                }
            }
        }