Print Page | Close Window

Kryboard shortcut as caption in Menu

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=15645
Printed Date: 16 November 2024 at 8:50pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Kryboard shortcut as caption in Menu
Posted By: rattana
Subject: Kryboard shortcut as caption in Menu
Date Posted: 17 November 2009 at 1:27am

Hello

I am trying to implement a pop up menu using CXTPcontrolpopUp and adding cxptcontrol to it . I need to append the keyboard shortcut associated with the cxtpcontrol.
the caption I gave is as below:-
"&New...\tCtrl+N"
SetCaption function of cxtpcontrol breaks the caption from "\t" and puts the caption as "New..." and the shortcut part is set as shortcuttextauto.
Is there any way I can get the caption of menu item as "&New...\tCtrl+N"
 
Thanks so much in advance
 



Replies:
Posted By: Smucker
Date Posted: 17 November 2009 at 3:21pm
You should let Codejock build the shortcut strings from the defined accelerators. This way is much easier than hard-coding them and handles customized keyboard shortcuts, which hard coding will not.

First, be sure to set this option in the CXTPCommandBars that hosts the popup:

GetCommandBarsOptions()->bShowContextMenuAccelerators

For using an regular accelerator resource (not designer shortcuts), you need to call:

GetCommandBars()->GetShortcutManager()->SetAccelerators(ACCELERATOR_RESOURCE_ID);

from the main frame's OnCreate(). Be sure to call it before loading the layout's user customizations.



-------------
Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net