예제 #1
0
            private int _keyCounter = 0;//keeps track of the number of times the user hits enter on the control after it gains focus.
            //
            public virtual bool ProcessReturnKey()
            {
                if (this.DroppedDown == true)
                {
                    _keyCounter++;
                    EditableDataGrid dg = this.Parent as EditableDataGrid;

                    if (DeviceInfo.DevicePlatform == PlatformType.WinCE &&
                        (dg != null && _keyCounter == 3))
                    {
                        dg.MoveSeclection(Direction.Right);
                        return(true);
                    }

                    else if (dg != null && _keyCounter == 2)
                    {
                        dg.MoveSeclection(Direction.Right);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    _keyCounter = 0;

                    IKeyPressProcessor p = this.Parent as IKeyPressProcessor;
                    if (p == null)
                    {
                        return(false);
                    }
                    return(p.ProcessReturnKey());
                }
            }
예제 #2
0
            public new bool ProcessDialogKey(Keys keyVal)
#endif
            {
                switch (keyVal)
                {
                case (Keys.Left):
                {
                    if (this.SelectionStart == 0)
                    {
                        EditableDataGrid dg = this.Parent as EditableDataGrid;
                        if (dg != null)
                        {
                            return(dg.MoveSeclection(Direction.Left));
                        }
                    }
                    break;
                }

                case (Keys.Right):
                {
                    if (this.SelectionStart == this.Text.Length)
                    {
                        EditableDataGrid dg = this.Parent as EditableDataGrid;
                        if (dg != null)
                        {
                            return(dg.MoveSeclection(Direction.Right));
                        }
                    }
                    break;
                }

                case (Keys.Up):
                {
                    if (this.DroppedDown == false)
                    {
                        EditableDataGrid dg = this.Parent as EditableDataGrid;
                        if (dg != null)
                        {
                            return(dg.MoveSeclection(Direction.Up));
                        }
                    }
                    break;
                }

                case (Keys.Down):
                {
                    if (this.DroppedDown == false)
                    {
                        EditableDataGrid dg = this.Parent as EditableDataGrid;
                        if (dg != null)
                        {
                            return(dg.MoveSeclection(Direction.Down));
                        }
                    }
                    break;
                }

                default:
                {
                    IKeyPressProcessor p = this.Parent as IKeyPressProcessor;
                    if (p == null)
                    {
                        return(false);
                    }
                    return(p.ProcessDialogKey(keyVal));
                }
                }
                return(false);
            }