We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set shortcut key of XPToolbar baritem other custom key combination?

I've got a baritem that uses the home key as its shortcut.

Since the home key is not present in System.Windows.Forms.Shortcut I've done this in the code on the key press event.

This works but the problem arises when I want to show the user that Home is the shortcut of the baritem.

I tried setting the baritem text to "Whatever\tCtrl+Home" like you did in C++/MFC but the \t escape sequence is a regular tab in the baritem control.

How can I achieve this?

Is there a way to set the Shortcut property of the baritem to be Home or some other key combination that is not part of System.Windows.Forms.Shortcut?

This would be ideal of course. It not possible, is there any way to fake the Ctrl+Home text in the shortcut column of the menu item text and tooltip?

Currently using 4.4.0.46 but will upgrade to the latest 5.2 version this week. Using VS2005 SP1.

Kind regards
/Jonas

1 Reply

JP Jonas Pettersson October 31, 2007 09:46 AM UTC

I found a solution for this, which is not supported by the designer so do it in such a place that it is not executed by the designer.

The predefined Shortcuts enum values are simply combinations of Keys enum values.

You can make your own combination as follows:

myBarItem.Shortcut = (Shortcut)(Keys.Shift | Keys.Home);

/Jonas

Loader.
Live Chat Icon For mobile
Up arrow icon