CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    21

    Making Toolbar settings persistent

    I have two toolbars and I am trying to make them persistent. I am using SaveBarState and LoadBarState. I call the LoadBarState in the OnCreate function in the MainFrame.cpp file, after I have created the toolbars and statusbars. I also call the savebarstate in the onclose function in the Mainframe.cpp. This doesn't seem to work with two toolbars, however it does work if you only have one toolbar. So, if anyone can help me out on this I would appreciate it.
    Thanks,
    Angie.


  2. #2
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Making Toolbar settings persistent

    Make sure so give each toolbar a unique ID when they are created.
    By default, they both get an ID of AFX_IDW_TOOLBAR so their
    states won't get saved correctly.



  3. #3
    Join Date
    May 1999
    Posts
    21

    Re: Making Toolbar settings persistent

    The toolbars are created with a unique id. Example: IDR_MAINFRAME
    IDR_SYSTEM_TOOLBAR
    IDR_TERRAIN_TOOLBAR

    I actually have three toolbars. If I only create one then I can save the state of that one but when I create all the results are not create.



  4. #4
    Guest

    Re: Making Toolbar settings persistent

    Hi,

    are you sure, that you give them different IDs ? The IDs must also
    different in the Create-Funktion, not only in LoadToolbar. Try this
    code, wich I found via www.deja.com.

    UINT flags = WS_CHILD | WS_VISIBLE | CBRS_TOP;

    if (!m_wndToolBar.Create(this,flags,IDR_MAINFRAME) ||
    !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
    TRACE0("Failed to create toolbar\n");
    return -1; // Fehler beim Erzeugen
    }



    hope that helps
    Achim
    [email protected]


  5. #5
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Making Toolbar settings persistent

    Yes, if an id is not passed to the Create call the toolbar id defaults to
    AFX_IDW_TOOLBAR


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured