Keyboard Customization not working 100% |
Post Reply |
Author | |
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 20 September 2006 at 4:10pm |
I have some tools on a toolbar that are not in any menus. So I added
the ids to the CXTPCustomizeKeyboardPage page. I then make key
assignments for my tools via the user interface.
Here is the problem. Some of the key assignments work and some don't. I've tracked down the difference between the tools that work and the tools that don't. Tools that work are handled like this in the Message Map: ON_COMMAND(IDC_PS_LEFT, OnAlignLeft) Tools that do not work are handled like this: ON_XTP_EXECUTE(IDC_FONT_BOLD, OnBold) Is there a way I can solve this? I'm using ON_XTP_EXECUTE so I have the control and can get its state. I'd really don't want to bail out on using ON_XTP_EXECUTE. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
It is MFC thing. When User press Key, OS generates WM_COMMAND message and ON_COMMAND handler executed. You can overide OnCommand and dispatch message if it is WM_COMMAND from accelerator.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
|
If I do that, will I have the CXTPControl associated with the button I
clicked on? I think not. If not, then it would be easier just to
implement the ON_COMMAND handler for the button and in that routine I
will have to search the toolbars for the button I'm interested in so I
can get its checked state.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Accelerators it is system thing. It will executed even if you don't have any button in toolbar or menu. Seems you have problem with architecture. Instead checking all controls to find checked state, add variable in CMainFrame that will store it and just check it and switch its state in ON_COMMAND handler. simple sample:
ON_COMMAND(ID_THEMES_THEMES, OnSwitchCommand)
ON_UPDATE_COMMAND_UI(ID_THEMES_THEMES, OnUpdateSwitchCommand) void CMainFrame::OnSwitchCommand()
{ m_bChecked = !m_bChecked; } void CMainFrame::OnUpdateSwitchCommand(CCmdUI* pCmdUI)
{ pCmdUI->SetCheck(m_bChecked); } |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Thanks. Yes, I know I can do that. I wanted to get away without adding
another variable since the button does know whether it is checked or
not. I guess I will have to add the variable since the user can use
customization to remove the button completely but still get the
behavior with the accell
Thanks again, I think all my questions regarding this topic have been answered. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |