Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - 11.2 CommandBars Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

11.2 CommandBars Problem

 Post Reply Post Reply
Author
Message
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Topic: 11.2 CommandBars Problem
    Posted: 15 September 2007 at 10:31am
Our app worked fine for 11.1.3 however with 11.2 we get the following problems:
 
1. the first time we run our app it is fine, however we have to delete the .xml file or the registry entry CommandBars-Controls from the registry (depending if we save to xml or registry, tried both ways)
 
However if we close our app and then rerun it it crashes due to GetParent() passing back 0xfeeefeee in the function:
 

void CXTPControlGallery::InvalidateItems(LPCRECT lpRect, BOOL bAnimate) { GetParent()->Redraw(lpRect ? lpRect : GetRect(), bAnimate); }

Any ideas much appreciated please as need to get this working so we can work over the weekend :(
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
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: 15 September 2007 at 10:49am
Hi,
please show full stack.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 11:05am
Stack is below as requested, cheers :)
 
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 11:06am
Also just so you know I have a derived class called CMyXTPControlGallery which just handles OnRButtonUp() and OnDblClick for left mouse button
 
Cheers
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 11:16am
At point of crash
 
GetRect() returns -17891602,-17891602,-17891602,-17891602 and m_pParent returns 0xfeeefeee in CXTPControl, not sure if this helps with above stack
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
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: 15 September 2007 at 11:37am
Thanks.
Show all code you have in CMainFrame::OnRibbonBarChanging. Double check it. I think you call methods of wrong object.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 11:41am
If I removed on the ontabchanging function it still happens on next SetCheckedItem called :(
 
the code is below:
 

NMXTPTABCHANGE *pNMTabChanged = (NMXTPTABCHANGE *)pNMHDR;

if ( pNMTabChanged->pTab )

{

// do nothing

}

*pRes = 0;

return;
 
but now it crashes in next call to SetCheckedItem() :(
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
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: 15 September 2007 at 12:14pm
Hi,
Show new call stack, and method code where you call SetCheckedItem.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 12:25pm
Hi

m_pControlGallery
->SetCheckedItem( nIndex != -1 ? nIndex : 0 );
 
is last setcheckeditem called where m_pControlGallery is a pointer to our CMyXTPGalleryControl derived class and is called from a class called CGalleryControl:

m_pControlGallery
= (CMyXTPControlGallery *)pRibbonGroup->Add( new CMyXTPControlGallery, ID_FORMAT_GALLERY );
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 12:29pm
But the strange thing which is why I dont think it is my code is that it works first run if I remove the XTP CommandBars-Controls from the registry
 
then 2nd, 3rd try etc. it crashes, like it saves something wrong ???
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 12:36pm
The actual error that appears is:
 
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
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: 15 September 2007 at 1:11pm
Hello,
 
I _really_ don't like what you have done.
 
Don't save controls pointers. if user minmize ribbonbar, it will create copy of same control, if usr add gallery to QuickAcess toolbar, control again copy self. and if user add in quick access group with gallery control, group will create copy again.  So don't update pointer this way.
 
Use Update handlers as our samples show.
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 1:14pm
please explain further as to what you think we are doing wrong ??? please as not sure I understand why this is bad ???
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 1:17pm
we do have update handlers, however we have two other classes:
 
CMyXTPControlGallery which has some overrides of XCTPControlGallery
 
and also we have a class called CGalleryControl which has lots of functionality we use for our galleries and this class has a pointer passed to it for the gallery control created using CMyXTPControlGallery so that the class can do SetCheckedItem etc. this worked fine in 11.1.3
 
just not 11.2 ???
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
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: 15 September 2007 at 1:35pm
Hi,
I just wrote why it is bad. When you call SetCheckedItem for pointer you saved it will update checked item only for main control in Ribbon - not in quick access toolbar, not in Minimized Ribon, etc.
 
Anyway if you need it, just check if m_pControlGallery->GetParent() != NULL before call its members.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 2:17pm
Ok, we are going to start changing our code to work more like the Ribbon Sample, however can you tell me what you think the best way of doing the following is please:
 
1. selecting a gallery item, as you say not to use SetCheckedItem outside of OnUpdate handler
2. is it safe to store pointers to ribbonbars, command bars etc. ???
 
Thanks
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 2:18pm
The reason we want to select gallery items, eg. is to restore settings once a user reloads app, eg. select same items in gallery
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2007 at 2:20pm
Ah I see how your Ribbon sample works, let me try that ;) as yes I agree it is better implementation ;)
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2007 at 5:35am
Thanks Oleg, once again you save the day, you were right, your implementation is much better and safer, and works great :)
 
Keep up the great support and apologies for wasting your time, just thought it wasn't our code as it worked in 11.1.3, but our implementation was bad.
 
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2007 at 5:39am
Dynamic Help was not installed :( for 11.2 into VS 2005, I tried installing several times ??? Any ideas please
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
bschaer View Drop Down
Groupie
Groupie


Joined: 27 June 2006
Location: United States
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote bschaer Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2007 at 9:02am
Immediate replies for a user that had problems due to his own poor coding design and NOT A PEEP regarding RemoveRecordEx/AddRecordEx issues that are CodeJock's fault!!!
Back to Top
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2007 at 6:52am
The problem is not on Oleg that (almost) every days gives answers to everyone on most aspect, the problem is that people  answering for reportcontrol leave unaswered question for days (or forever, check...).

We want Oleg also in ReportControl forum!!!
 
 
VS2008 SP1 - VS2010 SP1 - VS2012 - MFC MBCS Statically linked
XTP 15.3.1 Static Link
---------------------------------------------------------
Davide Zaccanti - ZakSoft - www.zaksoft.com
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2007 at 6:59am
Ok all working great with SetCheckedItem() now except what if we have a dynamically changing combo box, eg. ours shows paper sizes :( and if we change it later then not all quick access combo's :( change as same problem
 
Any ideas around this problem please ?
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
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: 18 September 2007 at 1:38am
Hello,
 
Sorry, guys, ReportControl, Calendar and SyntaxEdit are not my controls. I asked my colleague to check the question.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.172 seconds.