Print Page | Close Window

unable to switch menus between views

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=2347
Printed Date: 20 May 2024 at 12:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: unable to switch menus between views
Posted By: Oleg
Subject: unable to switch menus between views
Date Posted: 08 June 2005 at 11:02pm
Please show CMainFrame::OnCreate

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



Replies:
Posted By: bevpet
Date Posted: 08 June 2005 at 11:34pm

hi,

probably missing something again with the xtreme toolkit.

simple problem, i want to display a different menu when one of my other forms is displayed, but for some reason its not, i'm guessing there must another call i need to make to activate the menu i want besides having this :

// Register the application's document templates. Document templates

// serve as the connection between documents, frame windows and views.

m_pDocTemplateStartPage = new CMultiDocTemplate(

IDR_MAINFRAME,

RUNTIME_CLASS(CStartPageDoc),

RUNTIME_CLASS(CChildFrame),

RUNTIME_CLASS(CStartPageView));

AddDocTemplate(m_pDocTemplateStartPage);

//  main menu is above

////////////////////////////////////////////////////////////

m_pDocTemplateBrowserPage = new CMultiDocTemplate(

IDR_IE_MENU,

RUNTIME_CLASS(CStartPageDoc),

RUNTIME_CLASS(CChildFrame),

RUNTIME_CLASS(CBrowserView));

AddDocTemplate(m_pDocTemplateBrowserPage);

 

// this is class is a simple browser with the IE toolbar i'd like to so

// as the maintool bar is getting too cluttered.

//////////////////////////////////////////////////////////// /////////////////

 

any help on the above appreciated or where to look in the docs for the solution appreciated.

thanks

Peter

 



Posted By: bevpet
Date Posted: 10 June 2005 at 5:11pm

Hi Oleg,

as requested. thank you

 if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  return -1;

  if (!m_wndStatusBar.Create(this) ||
  !m_wndStatusBar.SetIndicators(indicators,
    sizeof(indicators)/sizeof(UINT)))
 {
  TRACE0("Failed to create the status bar\n");
  return -1;      // fail to create
 }


 theApp.GetSystemSettings(0);
 if (!InitCommandBars()) 
  return -1;

 CXTPCommandBars* pCommandBars = GetCommandBars();
 CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
 pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);

 CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
 if (!pCommandBar ||
  !pCommandBar->LoadToolBar(IDR_MAINFRAME))
 {
  TRACE0("Failed to create the main toolbar.\n");
  return -1;
 }

 pDatabaseBar = (CXTPToolBar*)pCommandBars->Add(_T("Database Navigation"), xtpBarTop);
 if (!pDatabaseBar ||
  !pDatabaseBar->LoadToolBar(IDR_TOOLBAR_DATABA SE))
 {
  TRACE0("Failed to create the database navigation toolbar.\n");
  return -1;
 }

 XTPImageManager()->SetMaskColor((COLORREF)-1); // Auto

 if (XTPImageManager()->IsAlphaIconsSupported())
 {
  XTPImageManager()->SetIcons(IDB_FAVORITES, favoritesicons,
   sizeof(favoritesicons)/sizeof(UINT), CSize(16, 16));

  XTPPaintManager()->GetIconsInfo()->bUseDis abledIcons = TRUE;
  CXTPImageManager::m_dDisabledBrightnessFactor = 2.0;
  CXTPImageManager::m_dDisabledAlphaFactor = 4.0;

 } else
 {
  CXTPOffice2003Theme::LoadModernToolbarIcons(IDR_ MAINFRAME);
  CXTPOffice2003Theme::LoadModernToolbarIcons(IDR_ MAINFRAME1);
  CXTPOffice2003Theme::LoadModernToolbarIcons(IDR_ TOOLBAR_WEB);
  CXTPOffice2003Theme::LoadModernToolbarIcons(IDR_ TOOLBAR_DATABASE);
 }
 XTPImageManager()->SetIcons(IDR_MAINFRAME);
 XTPImageManager()->SetIcons(IDR_TOOLBAR_WEB);
 XTPImageManager()->SetIcons(IDR_TOOLBAR_DATABASE);

 CXTPToolBar* pWebBar = (CXTPToolBar*)pCommandBars->Add(_T("Web"), xtpBarTop);
 if (!pWebBar ||
  !pWebBar->LoadToolBar(IDR_TOOLBAR_WEB))
 {
  TRACE0("Failed to create the web browser toolbar.\n");
  return -1;
 }

 LoadCommandBars(_T("CommandBars"));
 CCustomizePageTools::LoadTools("UserTools");

 GetDockingPaneManager()->InstallDockingPanes(this);
 m_paneManager.SetTheme((XTPDockingPanePaintTheme)theAp p.m_nPaneTheme);
 m_paneManager.SetAlphaDockingContext(TRUE);
 m_paneManager.SetShowDockingContextStickers(TRUE);

 CXTPDockingPaneLayout layoutNormal(GetDockingPaneManager());
 if (layoutNormal.Load(_T("NormalLayout")))
 {
  GetDockingPaneManager()->SetLayout(&layou tNormal);
 }
 else
 {
  CXTPDockingPane* paneOutput = GetDockingPaneManager()->CreatePane(
   ID_VIEW_OUTPUT_VIEW, CRect(0, 0, 210, 140), xtpPaneDockBottom);

  CXTPDockingPane* paneFindInFilesView = GetDockingPaneManager()->CreatePane(
   ID_VIEW_FINDINFILES_VIEW, CRect(0, 0, 210, 140), xtpPaneDockBottom);

  CXTPDockingPane* paneHelpView = GetDockingPaneManager()->CreatePane(
   ID_VIEW_DYNAMICHELP_VIEW, CRect(0, 0, 210, 140), xtpPaneDockRight);

  CXTPDockingPane* paneTasksView = GetDockingPaneManager()->CreatePane(
   ID_VIEW_TASKS_VIEW, CRect(0, 0, 210, 140), xtpPaneDockBottom);

  GetDockingPaneManager()->AttachPane(paneOutpu t, paneTasksView);
  GetDockingPaneManager()->AttachPane(paneFindI nFilesView, paneTasksView);

  paneTasksView->Select();
  }

 if (!CreateTaskPanel()) return FALSE;

 pCommandBars->GetCommandBarsOptions()->animation Type =   (XTPAnimationType)theApp.m_bxtpAnimateWindowsDef ault;
 pCommandBars->GetCommandBarsOptions()->bAlwaysSh owFullMenus = theApp.m_bAlwaysShowFullMenus;
 pCommandBars->GetCommandBarsOptions()->bDblClick Float = TRUE;
 pCommandBars->HideCommands(uHideCmds, _countof(uHideCmds));

 int nIDIcons[] = { // assign to menu/pane/tab item id
  XTPIDCUSTOMIZE, ID_VIEW_PROPERTIESWINDOW, 0, ID_VIEW_OUTPUT_VIEW,
  0, 0, ID_VIEW_TASKS_VIEW, 0, 0, 0, 0, ID_VIEW_FINDINFILES_VIEW, 0, 0,
  0, ID_VIEW_DYNAMICHELP_VIEW
 };

 GetDockingPaneManager()->SetIcons(IDB_BITMAP_PANELI CONS, nIDIcons,
  sizeof(nIDIcons)/sizeof(nIDIcons[0]), RGB(0, 255, 0));

 VERIFY(m_MTIClientWnd.Attach(this, TRUE));
 m_MTIClientWnd.GetPaintManager()->m_bShowIcons = TRUE;
 m_MTIClientWnd.SetAllowReorder(theApp.m_bAllowReorder[0]);
 m_MTIClientWnd.EnableToolTips();

 CXTPTabPaintManager* pTabPaintManager = new CXTPTabPaintManager();
 pTabPaintManager->SetColor(XTPTabColorStyle(theApp. m_nxtpTabColor[0]));
 pTabPaintManager->SetAppearance(XTPTabAppearanceSty le(theApp.m_nxtpTabAppearance[0]));
 pTabPaintManager->m_bOneNoteColors = theApp.m_bOneNoteColors[0];
 pTabPaintManager->m_bHotTracking = theApp.m_bHotTracking[0];
 pTabPaintManager->m_bShowIcons = theApp.m_bShowIcons[0];
 pTabPaintManager->m_szIcon = theApp.m_bLargeIcons[0]? CSize(32, 32): CSize(16, 16);
 pTabPaintManager->m_bBoldSelected = theApp.m_bBoldSelected[0];
 pTabPaintManager->m_bStaticFrame = theApp.m_bShowStaticFrame[0];
 pTabPaintManager->m_bOneNoteColors = theApp.m_bOneNoteColors[0];
 pTabPaintManager->m_bHotTracking = theApp.m_bHotTracking[0];
 pTabPaintManager->m_clientFrame = XTPTabClientFrame(theApp.m_nClientFrameStyle[0]);
 pTabPaintManager->SetLayout(XTPTabLayoutStyle(theAp p.m_nxtpTabLayout[0])); 
 pTabPaintManager->SetPosition(XTPTabPosition(theApp .m_nTabPositions[0]));
 pTabPaintManager->GetAppearanceSet()->m_rcHeader Margin.SetRect(2, 6, 2, 0);
 pTabPaintManager->m_rcClientMargin.SetRect(2, 2, 2, 2);
 pTabPaintManager->m_rcButtonMargin.SetRect(4, 1, 4, 1); 

 m_MTIClientWnd.SetPaintManager(pTabPaintManager);
 
 CXTWindowPos wndPosition;
 wndPosition.LoadWindowPos(this);

 theApp.GetSystemSettings(0); // LOAD USER PREFERENCES
 theApp.GetSystemSettings(1);
 theApp.GetSystemSettings(2);
 theApp.GetSystemSettings(3);

 CXTPPaintManager::SetTheme((XTPPaintTheme)theApp.m_nPa intTheme);
 OnSwitchTheme();


 return true;
}



Posted By: Oleg
Date Posted: 11 June 2005 at 8:53am

There is line

pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);

that don't make it. Remove it.



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


Posted By: bevpet
Date Posted: 11 June 2005 at 9:18am

appreciated,

thanks Oleg,

Peter




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