Ticket #6396: 6396.patch

File 6396.patch, 3.8 kB (added by becky, 6 months ago)

add pageup/pagedown support

  • Users/bgibson/Documents/workspace/trunk/dijit/form/_Spinner.js

     
    4343                        this._setStateClass(); 
    4444                }, 
    4545 
    46                 _arrowPressed: function(/*Node*/ nodePressed, /*Number*/ direction){ 
     46                _arrowPressed: function(/*Node*/ nodePressed, /*Number*/ direction, /*Number*/ increment){ 
    4747                        if(this.disabled || this.readOnly){ return; } 
    4848                        this._arrowState(nodePressed, true); 
    49                         this.setValue(this.adjust(this.getValue(), direction*this.smallDelta), false); 
     49                        this.setValue(this.adjust(this.getValue(), direction*increment), false); 
    5050                        dijit.selectInputText(this.textbox, this.textbox.value.length); 
    5151                }, 
    5252 
     
    5757                }, 
    5858 
    5959                _typematicCallback: function(/*Number*/ count, /*DOMNode*/ node, /*Event*/ evt){ 
    60                         if(node == this.textbox){ node = (evt.charOrCode == dojo.keys.UP_ARROW) ? this.upArrowNode : this.downArrowNode; } 
     60                        var inc=this.smallDelta; 
     61                        k=dojo.keys; 
     62                        if(node == this.textbox){  
     63                                switch(evt.charOrCode){ 
     64                                        case k.PAGE_UP: 
     65                                                node=this.upArrowNode; 
     66                                                inc = this.largeDelta; 
     67                                                break; 
     68                                        case k.PAGE_DOWN: 
     69                                                node=this.downArrowNode; 
     70                                                inc = this.largeDelta; 
     71                                                break; 
     72                                        case k.UP_ARROW: 
     73                                                node=this.upArrowNode; 
     74                                                break; 
     75                                        default: //k.DOWN_ARROW: 
     76                                                node=this.downArrowNode; 
     77                                } 
     78                        }                                                
    6179                        if(count == -1){ this._arrowReleased(node); } 
    62                         else{ this._arrowPressed(node, (node == this.upArrowNode) ? 1 : -1); } 
     80                        else{ this._arrowPressed(node, (node == this.upArrowNode) ? 1 : -1, inc); } 
    6381                }, 
    6482 
    6583                _wheelTimer: null, 
     
    7391                                var node = this[(scrollAmount > 0 ? "upArrowNode" : "downArrowNode" )]; 
    7492                                var dir = (scrollAmount > 0 ? 1 : -1); 
    7593                                 
    76                                 this._arrowPressed(node, dir); 
     94                                this._arrowPressed(node, dir, this.smallDelta); 
    7795 
    7896                                if(!this._wheelTimer){ 
    7997                                        clearTimeout(this._wheelTimer); 
     
    90108                        this.connect(this.domNode, !dojo.isMozilla ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled"); 
    91109                        this._connects.push(dijit.typematic.addListener(this.upArrowNode, this.textbox, {charOrCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 
    92110                        this._connects.push(dijit.typematic.addListener(this.downArrowNode, this.textbox, {charOrCode:dojo.keys.DOWN_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 
     111                        this._connects.push(dijit.typematic.addListener(this.upArrowNode, this.textbox, {charOrCode:dojo.keys.PAGE_UP,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 
     112                        this._connects.push(dijit.typematic.addListener(this.downArrowNode, this.textbox, {charOrCode:dojo.keys.PAGE_DOWN,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 
    93113                        if(dojo.isIE){ 
    94114                                var _this = this; 
    95115                                this.connect(this.domNode, "onresize", 
  • Users/bgibson/Documents/workspace/trunk/dijit/form/NumberSpinner.js

     
    88[dijit.form._Spinner, dijit.form.NumberTextBoxMixin], 
    99{ 
    1010        // summary: 
    11         // extends NumberTextBox to add up/down arrows for incremental change to the value 
     11        // extends NumberTextBox to add up/down arrows and pageup/pagedown for incremental change to the value 
    1212 
    1313        required: true, 
    1414