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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

69517 Oct 31,2007 04:26 AM Oct 31,2007 05:46 AM Windows Forms 1
loading
Tags: Tools
Jonas Pettersson
Asked On October 31, 2007 04:26 AM

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

Jonas Pettersson
Replied On October 31, 2007 05:46 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;