Roberto Nicchi Posted February 24, 2022 Share Posted February 24, 2022 Hello, in the main form of my application i have enabled monitoredkeys and defined the OnKeyDown event to manage hotkeys. (F1,F2 and so on) I would like to disable hot keys when a standard dialog windows is opened (messagedlg and showmessage) I would like that when a standard dialog form is opened the user can only click in the dialog buttons and don't use any hot key. Is there a way to do it in a single point of the application ? thanks Roberto Unigui 1.90.0.1556 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 24, 2022 Share Posted February 24, 2022 Hello, Need to analyze. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 24, 2022 Share Posted February 24, 2022 1 hour ago, Roberto Nicchi said: I would like that when a standard dialog form is opened the user can only click in the dialog buttons and don't use any hot key. Try this approach... MainForm.Script: Ext.onReady(function() { document.getElementById(Ext.getBody().id).addEventListener('keydown', function(e) { var cwin = Ext.WindowManager.getActive(); if (cwin && cwin.id == 'messagebox-1001' && e.key != 'Enter') { //other conditions e.preventDefault(); e.stopPropagation(); } }) }); 1 Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted February 24, 2022 Author Share Posted February 24, 2022 42 minutes ago, Sherzod said: Try this approach... MainForm.Script: Ext.onReady(function() { document.getElementById(Ext.getBody().id).addEventListener('keydown', function(e) { var cwin = Ext.WindowManager.getActive(); if (cwin && cwin.id == 'messagebox-1001' && e.key != 'Enter') { //other conditions e.preventDefault(); e.stopPropagation(); } }) }); It works perfectly. Thanks ! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.