Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Ctrl,Shift and Alt keys #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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