Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - HOWTO: Multiple accelerator tables
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO: Multiple accelerator tables

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: HOWTO: Multiple accelerator tables
    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 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 891
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 516
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2009 at 3:55am
Hi,

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

  Jimmy

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2009 at 4:23am
Ok;
have to be blind to oversee this function
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 891
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2009 at 4:02pm
mgampi, Which part of my post are you interested in?
 

pFrameWnd->m_hAccelTable = hAccelMDI;

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 891
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.828 seconds.