-
31 Jan 2007 12:34 PM #1
KeyListener not registering
KeyListener not registering
Hey All, I was wondering if someone could tell me why my key listener isn't working for the dialog I've created. The OK button closes the dialog, but for some reason "ESCAPE" isn't working. Here's the code snippet:
Code:handleFailure:function(o) { getEl('error-dlg-center').dom.innerHTML = o.responseText; if(!dialog) { dialog = new YAHOO.ext.LayoutDialog("error-dlg",{ modal:true, width:300, height:150, shadow:true, minWidth:300, minHeight:100, proxyDrag: true }); dialog.addKeyListener(27, dialog.hide, dialog); dialog.addButton('OK', dialog.hide, dialog); } dialog.show(getEl('status').dom); Frame.updateStatus('Error Loading.', 'done') },
-
31 Jan 2007 12:41 PM #2
The dialog has to have focus for the listener to work. You can also do this by using setDefaultButton
Code:dlg.addKeyListener(27, dlg.hide, dlg); dlg.addButton('OK', this.okHandler...); dlg.setDefaultButton(dlg.addButton('Close', dlg.hide, dlg));Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
31 Jan 2007 12:45 PM #3
Similar Threads
-
HelloWorld Dialog KeyListener and IE7 Problem
By jongohr in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 1 May 2008, 12:30 AM -
Registering resized and invalidated listener with laoyout Re
By wavel in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 5 Mar 2007, 11:27 PM -
YUI Help - KeyListener + Event
By allaboutyui in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 1 Jan 2007, 3:04 PM -
KeyListener, Tabpanel and rest of the site
By wannabe in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 15 Sep 2006, 10:43 AM


Reply With Quote