Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Multiple-Top Level Documents Issue
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple-Top Level Documents Issue

 Post Reply Post Reply
Author
Message
mgoldshteyn View Drop Down
Groupie
Groupie


Joined: 30 December 2007
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgoldshteyn Quote  Post ReplyReply Direct Link To This Post Topic: Multiple-Top Level Documents Issue
    Posted: 30 December 2007 at 10:28am
1. Create a new Tookit Pro project using App Wizard ((VS2005 or VS2008) and XTP 11.2.2)
2. Under Application Type, select Multiple top-level documents
3. Deselect Use Unicode libraries on that same page
4. Leave all other settings as is
5. Click Finish
6. Build and run the resultant application in Debug mode
7. When the app is running, select New Frame from the File menu
8. *KABOOM* to an assertion, since the new Frame has no menu, even though one was assigned at the time of window creation.
 
Mike
 
Back to Top
mgoldshteyn View Drop Down
Groupie
Groupie


Joined: 30 December 2007
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgoldshteyn Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2007 at 3:19pm
Here is the fix! Modify the following code in the AppWizard generated CMainFrame::LoadFrame()
 
// replace Exit option on File menu with Close for secondary windows
if (AfxGetApp()->m_pMainWnd != this)
{
  CMenu *pMenu = GetMenu();
  ASSERT(pMenu);
  pMenu->ModifyMenu(ID_APP_EXIT, MF_BYCOMMAND | MF_STRING, ID_FILE_CLOSE, _T("&Close"));
}
 
with:
 
// replace Exit option on File menu with Close for secondary windows
if (AfxGetApp()->m_pMainWnd != this)
{
  // Find the File/Exit control nested deep in the command bar hierarchy
  CXTPControl *pAppExitControl=GetCommandBars()->FindControl(xtpControlButton, ID_APP_EXIT, TRUE /*Visible*/, TRUE /*Recursive*/);
  // If File/Exit was found, change its name/behavior to File/Close
  if (pAppExitControl)
  {
    // Change its ID and caption to that of File/Close
    pAppExitControl->SetID(ID_FILE_CLOSE);
    pAppExitControl->SetCaption(_T("&Close"));
  }
}

Oleg or another admin, please comment on this solution. Also, for everyone's sake, fix the AppWizard generated code in the next release to use the code above or something similar.
 
 
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 02 January 2008 at 2:07am

Hi,

Thanks, we changed appwizard with this code. Thanks for help.
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.047 seconds.