PDA

View Full Version : Keylistener for entire site (resolved)



para
7 May 2007, 6:49 AM
I haven't been able to find a good example or post on what I'm trying to do.
I have implemented an undo/redo functionality on my site. I would like to have the undo/redo functions called when I push CNTL+Z and CNTL+Y, no matter where the focus is.
Anyone have a one liner for me ?
:)

Animal
7 May 2007, 6:56 AM
function myUndoFunction() {
}

function myRedoFunction() {
}

Ext.onReady(function() {
new Ext.KeyMap(Ext.get(document), [{
key: 'Y',
ctrl: true,
fn: myRedoFunction
}, {
key: 'Z',
ctrl: true,
fn: myUndoFunction
}]);
});

para
7 May 2007, 7:13 AM
That's similar to what i was trying... I just wasn't using the Ext.get(document).
Works great. Thanks.