Changeset 13267

Show
Ignore:
Timestamp:
04/04/08 13:45:59 (9 months ago)
Author:
toonetown
Message:

fixes #6250: implements hover-based scrolling as an option (defaults to false) on dijit._TimePicker

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/tests/form/test_TimeTextBox.html

    r12730 r13267  
    121121        </div> 
    122122 
     123        <div class="dojoTitlePaneLabel"> 
     124                <label for="q6"> Hover-based scrolling 12 Hour Time </label> 
     125                <span class="noticeMessage">TimeTextBox class, 
     126                        Attributes: {hoverScroll: true, timePattern:'h:mm:ss a'}</span> 
     127        </div> 
     128        <div class="testExample"> 
     129                <input id="q6" type="text" name="timeauto" class="medium" value="T17:45:00" 
     130                        dojoType="dijit.form.TimeTextBox" 
     131                        constraints="{hoverScroll: true, timePattern:'h:mm:ss a'}" 
     132                        required="true" 
     133                        invalidMessage="Invalid time." /> 
     134        </div> 
     135 
    123136        <script> 
    124137                function displayData() { 
  • dijit/trunk/_TimePicker.js

    r13266 r13267  
    2020                //              see dijit._TimePicker.visibleRange 
    2121                visibleRange: "T05:00:00" 
     22                 
     23                // hoverScroll: Boolean 
     24                //              see dijit._TimePicker.hoverScroll 
    2225        } 
    2326); 
     
    5558                //              Example: `T05:00:00` displays 5 hours of options 
    5659                visibleRange: "T05:00:00", 
     60 
     61                // hoverScroll: Boolean 
     62                //              Specifying true here will have the time picker scroll by only 
     63                //              hovering on the arrow buttons - rather than needing to click 
     64                //              them.  It is accomplished by kicking off a typematic trigger 
     65                //              when the buttons are hovered. 
     66                hoverScroll: false, 
    5767 
    5868                // value: String 
     
    158168                        //dijit.typematic.addListener(this.upArrow,this.timeMenu, {keyCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_onArrowUp", 0.8, 500); 
    159169                        //dijit.typematic.addListener(this.downArrow, this.timeMenu, {keyCode:dojo.keys.DOWN_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_onArrowDown", 0.8,500); 
    160  
     170                         
     171                        if(this.hoverScroll){ 
     172                                // Connect some callback functions to the hover event of the arrows 
     173                                var triggerFx = function(cb){ 
     174                                        return function(cnt){ 
     175                                                // don't run on the first firing 
     176                                                if(cnt > 0){cb.call(this, arguments);} 
     177                                        }; 
     178                                }; 
     179                                var hoverFx = function(node, cb){ 
     180                                        return function(e){ 
     181                                                dojo.stopEvent(e); 
     182                                                dijit.typematic.trigger(e, this, node, triggerFx(cb), node, 0.85, 250); 
     183                                        }; 
     184                                }; 
     185                                this.connect(this.upArrow, "onmouseover", hoverFx(this.upArrow, this._onArrowUp)); 
     186                                this.connect(this.downArrow, "onmouseover", hoverFx(this.downArrow, this._onArrowDown)); 
     187                        } 
     188                         
    161189                        this.inherited(arguments); 
    162190                        this.setValue(this.value);