Print Page | Close Window

Assert in CustomizeKeyboardPage

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=4688
Printed Date: 11 November 2025 at 12:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Assert in CustomizeKeyboardPage
Posted By: danpetitt
Subject: Assert in CustomizeKeyboardPage
Date Posted: 31 July 2006 at 2:55pm
I am getting an ASSERT in CXTPCustomizeKeyboardPage Constructor:
 ASSERT(pSheet->GetCommandBars()->GetShortcutManager()->GetOriginalAccelerator());
 
These are my calls in CMainFrm::OnCreate:
 pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues( xtpKeyboardCuesShowWindowsDefault );
 pCommandBars->GetToolTipContext()->SetStyle( xtpToolTipOffice );
 pCommandBars->GetShortcutManager()->SetAccelerators( IDR_MAINFRAME );
 pCommandBars->GetShortcutManager()->SetAccelerators( IDR_SGENIETYPE );
 
Why is this, whats an OriginalAccelerator, why do I need it and why isnt it there?
 
I am not using "LoadCommandBars" to load/save them, I am using PropExchange.
 
Can you point me in the right direction.



Replies:
Posted By: Oleg
Date Posted: 31 July 2006 at 3:22pm
Don't call
pCommandBars->GetShortcutManager()->SetAccelerators( IDR_SGENIETYPE );
just
pCommandBars->GetShortcutManager()->SetAccelerators( IDR_MAINFRAME );
 
only last accelerators for last call used.


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


Posted By: danpetitt
Date Posted: 31 July 2006 at 3:43pm

Problem is, I am not getting any of my mainframe shortcuts in the customize dialog or available to my application without using the "SetAccelerators(IDR_SGENIETYPE)".



Posted By: danpetitt
Date Posted: 31 July 2006 at 5:15pm
What I found is that my DoPropExchange on (first time) is destroying the accelerator table ready for loading in, but there is nothing to load in so now I have no accelerators.
 
Any ideas what to do?


Posted By: danpetitt
Date Posted: 31 July 2006 at 5:25pm

More investigation seems that if the saved XML file doesnt have any shortcut section then it clears the accelerator table and cant fill it back with anything.

What it ought to do is only UpdateAcellTable (CXTPShortcutManager::DoPropExchange) if "accels.GetSize()" then it will only replace when there is something to replace it with.

Or even modify "CXTPShortcutManager::UpdateAcellTable":

void CXTPShortcutManager::UpdateAcellTable(LPACCEL lpAccel, int nSize)
{
 HACCEL hAccelNew = ::CreateAcceleratorTable(lpAccel, nSize);
 if( hAccelNew )
 {
   SAFE_DESTROY_ACCELTABLE(m_hAccelTable);
   m_hAccelTable = hAccelNew;
 }
}
 


Posted By: Oleg
Date Posted: 01 August 2006 at 9:29am
Hello,
no, it is designed behaviour. don't change it.  Just delete old xml configuration file.


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



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