示例#1
0
        /// <summary>
        /// Move forward selection
        /// </summary>
        public void MoveSelectionForward()
        {
            if (SelectionMovedForward != null)
            {
                var arg = new SelectionMoveForwardEventArgs();
                SelectionMovedForward(this, arg);
                if (arg.IsCancelled)
                {
                    return;
                }
            }

#if EX_SCRIPT
            var scriptReturn = RaiseScriptEvent("onnextfocus");
            if (scriptReturn != null && !ScriptRunningMachine.GetBoolValue(scriptReturn))
            {
                return;
            }
#endif

            switch (selectionForwardDirection)
            {
            case SelectionForwardDirection.Right:
            {
                if (this.selEnd.Col < this.cols.Count - 1)
                {
                    MoveSelectionRight();
                }
                else
                {
                    if (this.selEnd.Row < this.rows.Count - 1)
                    {
                        this.selEnd.Col = 0;
                        MoveSelectionDown();
                    }
                }
            }
            break;

            case SelectionForwardDirection.Down:
            {
                if (this.selEnd.Row < this.rows.Count - 1)
                {
                    this.selEnd.Col = this.focusReturnColumn;

                    MoveSelectionDown();
                }
                else
                {
                    if (this.selEnd.Col < this.cols.Count - 1)
                    {
                        this.selEnd.Row = 0;
                        MoveSelectionRight();
                    }
                }
            }
            break;
            }
        }
示例#2
0
        /// <summary>
        /// Move backward selection
        /// </summary>
        public void MoveSelectionBackward()
        {
            if (SelectionMovedBackward != null)
            {
                var arg = new SelectionMoveForwardEventArgs();
                SelectionMovedForward(this, arg);
                if (arg.IsCancelled)
                {
                    return;
                }
            }

#if EX_SCRIPT
            var scriptReturn = RaiseScriptEvent("onpreviousfocus");
            if (scriptReturn != null && !ScriptRunningMachine.GetBoolValue(scriptReturn))
            {
                return;
            }
#endif

            switch (selectionForwardDirection)
            {
            case SelectionForwardDirection.Right:
            {
                if (selEnd.Col > 0)
                {
                    MoveSelectionLeft();
                }
            }
            break;

            case SelectionForwardDirection.Down:
            {
                if (selEnd.Row > 0)
                {
                    MoveSelectionUp();
                }
            }
            break;
            }
        }