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. Toolbars and MDI Apps

Toolbars and MDI Apps

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialworkspace
3 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.
  • C Offline
    C Offline
    Chambers
    wrote on last edited by
    #1

    Alright All, I have a small brain teaser to do with Toolbars. I have managed to setup a toolbar successfully in the CMainFrame section of MDI App. Every time I open a file / create a new file it adds the relevant information to the combo box (i.e. the name of the file). Its then possible that I do some operations on these files, the names of these operations are then also recorded IN ORDER in the combo box. However, since I have an MDI app, and I`ve used the CMainFrame section to house the combo box, it is possible that the user mixes up the entries in the combo box that are associated with the different windows. I would like to be able to keep them separate, so that when the user clicks on a particular window, the combo box reflects the changes I`ve made to that one and that one only (and if I re-activated the other window it would re-display all the changes to that one etc.). I would appreciate any advice on this, even if it was to just tell me where to store the combo box control or how to switch back and forth different combo boxes as the different windows are activated. Cheers again guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:

    R 1 Reply Last reply
    0
    • C Chambers

      Alright All, I have a small brain teaser to do with Toolbars. I have managed to setup a toolbar successfully in the CMainFrame section of MDI App. Every time I open a file / create a new file it adds the relevant information to the combo box (i.e. the name of the file). Its then possible that I do some operations on these files, the names of these operations are then also recorded IN ORDER in the combo box. However, since I have an MDI app, and I`ve used the CMainFrame section to house the combo box, it is possible that the user mixes up the entries in the combo box that are associated with the different windows. I would like to be able to keep them separate, so that when the user clicks on a particular window, the combo box reflects the changes I`ve made to that one and that one only (and if I re-activated the other window it would re-display all the changes to that one etc.). I would appreciate any advice on this, even if it was to just tell me where to store the combo box control or how to switch back and forth different combo boxes as the different windows are activated. Cheers again guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      I would recommend keeping the list of changes you have made in the document object. Then wehn tyhe user switches document, (or toa different view), you can handle the OnSetActive of that view and populate the combo box in the toolbar. Something like:

      void CMyView::OnSetActive(bool m_bActivate)
      {
      if (m_bActivate)
      {
      CComboBox* pCombo = &((CMainFrame*)(AfxGetApp()->m_pMainWnd))->m_ComboBox ; // get pointer to combo from mainframe object
      pCombo->ResetContent() ;
      // add the items here...
      }
      }

      Its a bit rough and done from memory so it may be a little bit buggy:-D Roger Allen Sonork 100.10016

      C 1 Reply Last reply
      0
      • R Roger Allen

        I would recommend keeping the list of changes you have made in the document object. Then wehn tyhe user switches document, (or toa different view), you can handle the OnSetActive of that view and populate the combo box in the toolbar. Something like:

        void CMyView::OnSetActive(bool m_bActivate)
        {
        if (m_bActivate)
        {
        CComboBox* pCombo = &((CMainFrame*)(AfxGetApp()->m_pMainWnd))->m_ComboBox ; // get pointer to combo from mainframe object
        pCombo->ResetContent() ;
        // add the items here...
        }
        }

        Its a bit rough and done from memory so it may be a little bit buggy:-D Roger Allen Sonork 100.10016

        C Offline
        C Offline
        Chambers
        wrote on last edited by
        #3

        After I had written the question, for some unknown reason (I`ll call it fate), this exact same solution came into my head. I was, in fact just about to delete this thread thinking that no-one would respond so quickly, amazing. I would, however, like to thank you for responding and re-affirming this solution, because it came from nowhere in my head, and I always tend to think "is this the best solution - mmmm I dunno", but since your response I have no fear. Thanks Roger, very much appreciated, Alan.:-D P.S. your solution seems pretty damn good, if thats "a bit rough" I feel quite inadequate :-D. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:

        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