BCGSoft > Developer Area > Keyboard and Mouse customization

Keyboard and Mouse customization

The BCGControlBar Library framework allows to implement full keyboard and mouse customization.

The keyboard and mouse customization features are handled by the CBCGPToolbarCustomize class. An object of this class is a property sheet, that contains "Keyboard" and "Mouse" pages among other customization pages.

Take a look at the pictures of "Keyboard" and "Mouse" property pages: 

The keyboard customization allows to assign various keyboard shortcuts to the application commands. These shortcuts are maintained in accelerator tables. BCGControlBar framework automatically supports multiple accelerator tables used with document templates. 

To take advantage of the keyboard customization just call the CBCGPWorkspace::InitKeyboardManager  function from InitInstance . It creates the global CBCGPKeyboardManager object. When you instantiate the CBCGPToolbarCustomize customization dialog, it checks, whether the keyboard manager does exist or not, and inserts the "Keyboard" property page, if it does.

Note. You can use CBCGPKeyMapDlg to display the current application key map.

The mouse customization allows to associate double-click events (for views only!) with the application commands. For example, user can define that "Undo" command should be executed when he/she double clicks the left mouse button over the specified view.

To include the mouse customization you should perform the following steps:

  1. Call the CBCGPWorkspace::InitMouseManager function from InitInstance. It creates the global CBCGPMouseManager object.
  2. Override the CBCGPWorkspace::PreLoadState function and call CBCGPMouseManager::AddView for each view that can be customized by the user.
     

Note. You can get access to the keyboard and mouse managers everywhere in the application by calling CBCGPWorkspace::GetKeyboardManager and CBCGPWorkspace::GetMouseManager.

Back to the Developer Area