Skip to content

KeyBindings Property

Description

Gets the collection of key bindings (accelerator keys) associated with the various commands used in command bars.

Property Type

Read-only property

Syntax (Visual Basic)

Public Property KeyBindings() As [KeyBindings](XtremeCommandBars~KeyBindings.md)

Remarks

You can create a shortcut from any combination of keys on the keyboard. Command Bars will automatically place the key combination of the shortcut in the menu next to the caption of the control.

Example

KeyBindings Sample (Visual Basic)

This sample code illustrates how to add shortcuts to the controls in your Command Bar.

' These constants are in the General code section  
Const FSHIFT = 4  
Const FCONTROL = 8  
Const FALT = 16  
Const VK_F5 = &H74  

' Add Keybindings after the Command Bar is created  
' Adds Ctrl+N KeyBinding  
CommandBars.KeyBindings.Add FCONTROL, Asc("N"), ID_FILE_NEW  

' Adds Ctrl+SHIFT+O KeyBinding  
CommandBars.KeyBindings.Add FCONTROL + FSHIFT, Asc("O"), ID_FILE_OPEN  

' Adds F5 KeyBinding  
CommandBars.KeyBindings.Add 0, VK_F5, ID_FILE_CLOSE  

' Adds Ctrl+S KeyBinding  
CommandBars.KeyBindings.Add FCONTROL, Asc("S"), ID_FILE_SAVE  

' Adds ALT+P KeyBinding  
CommandBars.KeyBindings.Add FALT, Asc("P"), ID_FILE_PRINT  

' Adds ALT+SHIFT+Ctrl+P KeyBinding  
CommandBars.KeyBindings.Add FALT + FSHIFT + FCONTROL, Asc("P"), ID_FILE_PRINT_SETUP  

' Adds ALT+Ctrl+X KeyBinding  
CommandBars.KeyBindings.Add FCONTROL + FALT, Asc("X"), ID_FILE_EXIT  

See Also


See Also

Command Bars ActiveX Control v24.0


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.