Skip to content

Conversation

@Jorwin
Copy link

@Jorwin Jorwin commented Mar 25, 2017

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