Print Page | Close Window

HOWTO: Multiple accelerator tables

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=14872
Printed Date: 26 September 2024 at 2:08pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO: Multiple accelerator tables
Posted By: mgampi
Subject: HOWTO: Multiple accelerator tables
Date Posted: 30 July 2009 at 9:27am
Hi;
I created a MDI app with different document types and each type has its own ACCELERATORS resource.
The accelerators all work very well, but only the shortcuts for the main accel table (IDR_MAINFRAME) are shown in all commandbar objects.
What do I have to do to see also shortcuts for the currently active document type?


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Replies:
Posted By: Oleg
Date Posted: 31 July 2009 at 4:08am

Hi,

Indeed only single Table supported :( Copy all shortcuts from document to main frame's.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 31 July 2009 at 4:12am
Hi;

In my case thats not possible, because same shortcuts execute different commands in differnet document types.
Is no other solution available?


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: rdhd
Date Posted: 05 August 2009 at 6:42pm
We swap out the MFC frame's accel table handle (I think it is "m_hAccel") as we navigate among our various doc types. We also rebuild the command ribbon when we do the MDI transition. And last but not least, whenever any customization occurs, we save the changes to the registry. So when we load an accel table for a particular MDI document, we first check the registry and use any table saved there, otherwise we load the accel resource corresponding to the doc type.


Posted By: mgampi
Date Posted: 06 August 2009 at 3:35am
Originally posted by rdhd rdhd wrote:

We swap out the MFC frame's accel table handle (I think it is "m_hAccel") as we navigate among our various doc types. We also rebuild the command ribbon when we do the MDI transition. And last but not least, whenever any customization occurs, we save the changes to the registry. So when we load an accel table for a particular MDI document, we first check the registry and use any table saved there, otherwise we load the accel resource corresponding to the doc type.

Hi;

Could you show a brief example how you do this? This would be very welcome...


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: jimmy
Date Posted: 06 August 2009 at 3:55am
Hi,

Use CopyAcceleratorTable to merge two accelerator tables.
And set the new hAccel.

  Jimmy



Posted By: mgampi
Date Posted: 06 August 2009 at 4:23am
Ok;
have to be blind to oversee this function


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: rdhd
Date Posted: 06 August 2009 at 4:02pm
mgampi, Which part of my post are you interested in?
 

pFrameWnd->m_hAccelTable = hAccelMDI;



Posted By: mgampi
Date Posted: 07 August 2009 at 3:17am
Originally posted by rdhd rdhd wrote:

mgampi, Which part of my post are you interested in?
 

pFrameWnd->m_hAccelTable = hAccelMDI;


How to swap accel tables while stepping through different document types...


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: rdhd
Date Posted: 10 August 2009 at 8:51am
Simply load your table and set the m_hAccelTable of the frame window to the handle of the table you loaded. We don't have to do anything else for accelerators. We set the table before we build our command ribbon.



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