Skip to content

Support for Ctrl,Shift and Alt keys#335

Open
Jorwin wants to merge 1 commit into
nakupanda:masterfrom
Jorwin:master
Open

Support for Ctrl,Shift and Alt keys#335
Jorwin wants to merge 1 commit into
nakupanda:masterfrom
Jorwin:master

Conversation

@Jorwin

@Jorwin Jorwin commented Mar 25, 2017

Copy link
Copy Markdown

Added support for the alt,Shift and ctrl keys, this way you can use example key combination
Alt + O
Ctrl + O,
An example of how to use it is as follows

BootstrapDialog.show({
title: 'Button Hotkey',
message: 'Try to press some keys...',
onshow: function(dialog) {
dialog.getButton('button-c').disable();
},
buttons: [{
label: '(A) Button A',
hotkey: 65, // Keycode of keyup event of key 'A' is 65.
altKey: true,
action: function() {
alert('Finally, you loved Button A.');
}
}, {
label: '(B) Button B',
hotkey: 66,
shiftKey: true,
action: function() {
alert('Hello, this is Button B!');
}
}, {
id: 'button-c',
label: '(C) Button C',
hotkey: 67,
ctrlKey: true,
action: function(){
alert('This is Button C but you won't see me dance.');
}
}]
});

Added support for the alt and ctrl keys, this way you can use example key combination
Alt + O
Ctrl + O,
An example of how to use it is as follows

 BootstrapDialog.show({
            title: 'Button Hotkey',
            message: 'Try to press some keys...',
            onshow: function(dialog) {
                dialog.getButton('button-c').disable();
            },
            buttons: [{
                label: '(A) Button A',
                hotkey: 65, // Keycode of keyup event of key 'A' is 65.
		altKey: true,
                action: function() {
                    alert('Finally, you loved Button A.');
                }
            }, {
                label: '(B) Button B',
                hotkey: 66,
		shiftKey: true,
                action: function() {
                    alert('Hello, this is Button B!');
                }
            }, {
                id: 'button-c',
                label: '(C) Button C',
                hotkey: 67,
		ctrlKey: true,
                action: function(){
                    alert('This is Button C but you won\'t see me dance.');
                }
            }]
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant