Print Page | Close Window

Accelerators within a dialog

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2476
Printed Date: 10 October 2025 at 5:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Accelerators within a dialog
Posted By: Uwe Keim
Subject: Accelerators within a dialog
Date Posted: 29 June 2005 at 4:33am

Scenario: A SDI application, having several modal dialog boxes with local CodeJock menubars, toolbars, statusbars.

No I want to add accelerators to the menu items in the dialog.

I managed to do it the way I found it in the "DialogSample" in the "%PROGRAM_FILES\Codejock Software\MFC\Xtreme Toolkit Pro v9.60\Samples\CommandBars\DialogSample" folder.

What I am missing: In the main window of my SDI application, the CodeJock library automatically writes the actual shortcuts beside the menu items. Whereas in the "DialogSample" application they are hardcoded in the IDR_MAINFRAME resource.

Question: Is it possible to "tell" a menubar which accelerator-resource to use and let the menubar do all the accelerator-handling (include writing to the menu items and command routing) from within a child dialog box?

Thanks
Uwe




Replies:
Posted By: bevpet
Date Posted: 29 June 2005 at 2:56pm

try this

declare oin .h

HACCEL m_hAccel;

add your your dlg.cpp:

CMyDlg::CMyDlg()

: CDialog(CMyDlg::IDD, 0)

{

//{{AFX_DATA_INIT(CMyDlg)

...

...

m_hAccel = ::LoadAccelerators(AfxGetInstanceHandle(),

MAKEINTRESOURCE(IDR_MY_DLG_ACCELERATORS));

...

}

where:

IDR_MY_DLG_ACCELERATORS = your accelerator table you wish to associate with the dlg.

HTH

 



Posted By: Uwe Keim
Date Posted: 29 June 2005 at 11:46pm

bevpet, thank you, but this is from the example as I'm already doing.




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