Jump to content

Disable hot keys in standard dialog windows (MessageDlg and ShowMessage)


Roberto Nicchi

Recommended Posts

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

Link to comment
Share on other sites

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();
        }
    })
});

 

  • Like 1
Link to comment
Share on other sites

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 !

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...