Here's the keystroke capture function from the file manager I'm working on.
Hope it helps.

You may want to bind the keydown to the object instead. Mine intercepts all
keystrokes unless specifically prevented.

document.onkeydown = function(e) {
        
        if (protectKeystrokes) {return true;}
        
        if (window.event) { // IE
                var keyCode = window.event.keyCode;
                var ctrlKey = window.event.ctrlKey;
        } else { // FF
                var keyCode = e.which;
                var ctrlKey = e.ctrlKey;
        }
        
        //alert(keyCode);
        //return false;
        switch(keyCode) {
        case 13: // enter
        case 32: // space bar
                if ($(selectedNode).is('.dir')) {
                        toggleDir(selectedNode);
                } else {
                        openFile(selectedNode);
                }
                return true;    
                break;
        case 38: // up arrow
                moveSelectUp();
                return true;
                break;
        case 40: // down arrow
                moveSelectDown();
                return true;
                break;
        case 46: // delete
                promptDelete(selectedNode);
                return true;
                break;
        case 113: // F2
                $('#nameField').get(0).focus();
                return true;
                break;
        }
        switch (String.fromCharCode(keyCode).toLowerCase()) {
        case 'o':
                if (ctrlKey) {
                        if ($(selectedNode).is('.dir')) {
                                openDir(selectedNode);
                        } else {
                                openFile(selectedNode);
                        }
                        if (window.event) {
                                // block dialog
                                window.event.keyCode = 505;
                        }
                        return false;
                }
                break;
        }
}


blemming wrote:
> 
> I would love to add keyboard navigation to the dropdown but I don't even
> know where to start...... Anybody have any pointers to get me started in
> the right direction?
> 

-- 
View this message in context: 
http://www.nabble.com/My-First-Plugin---Custom-Select-Box-tf2893253.html#a8089291
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to