Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Change tool bar according to document

Change tool bar according to document

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Max
    wrote on last edited by
    #1

    My project is about MDI with Multi-Document. In each document has it own menu and toolbar, it mean that the menu and toolbar must change according to activate child windows. For the menu,I use code below within InitInstance function to add document template then the menu (IDR_MSESoftTYPE and IDR_RECEIPT) can change according to activate child windows, so the menu already work fine.

    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(IDR_MSESoftTYPE,
    RUNTIME_CLASS(CMSESoftDoc),
    RUNTIME_CLASS(CChildFrame), // custom MDI child frame
    RUNTIME_CLASS(CMSESoftView));
    if (!pDocTemplate)
    return FALSE;
    AddDocTemplate(pDocTemplate);

    pDocTemplate = new CMultiDocTemplate(IDR\_RECEIPT,
    	RUNTIME\_CLASS(CReceiptDoc),
    	RUNTIME\_CLASS(CReceiptFrame), // custom MDI child frame
    	RUNTIME\_CLASS(CReceiptView));
    if (!pDocTemplate)
    	return FALSE;
    AddDocTemplate(pDocTemplate);
                                                        \*
                                                        \*
                                                        \*
    

    What about the toolbar how can I make it like menu. Thanks

    I 1 Reply Last reply
    0
    • M Max

      My project is about MDI with Multi-Document. In each document has it own menu and toolbar, it mean that the menu and toolbar must change according to activate child windows. For the menu,I use code below within InitInstance function to add document template then the menu (IDR_MSESoftTYPE and IDR_RECEIPT) can change according to activate child windows, so the menu already work fine.

      CMultiDocTemplate* pDocTemplate;
      pDocTemplate = new CMultiDocTemplate(IDR_MSESoftTYPE,
      RUNTIME_CLASS(CMSESoftDoc),
      RUNTIME_CLASS(CChildFrame), // custom MDI child frame
      RUNTIME_CLASS(CMSESoftView));
      if (!pDocTemplate)
      return FALSE;
      AddDocTemplate(pDocTemplate);

      pDocTemplate = new CMultiDocTemplate(IDR\_RECEIPT,
      	RUNTIME\_CLASS(CReceiptDoc),
      	RUNTIME\_CLASS(CReceiptFrame), // custom MDI child frame
      	RUNTIME\_CLASS(CReceiptView));
      if (!pDocTemplate)
      	return FALSE;
      AddDocTemplate(pDocTemplate);
                                                          \*
                                                          \*
                                                          \*
      

      What about the toolbar how can I make it like menu. Thanks

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      I can think of one "simple" solution: Don't have any main frame toolbars - but have them inside the childframe. You could also swap main toolbars in the childframes activate code, but that would be more fragile... I'd go for the first idea if I was you. Iain.

      I have now moved to Sweden for love (awwww).

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups