Click to See Complete Forum and Search --> : Making Toolbar settings persistent
Angie
June 10th, 1999, 03:13 PM
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.
Gomez Addams
June 10th, 1999, 03:25 PM
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.
Angie
June 10th, 1999, 03:39 PM
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.
June 23rd, 1999, 04:58 AM
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
achim@saarlouis.com
Gomez Addams
June 23rd, 1999, 12:49 PM
Yes, if an id is not passed to the Create call the toolbar id defaults to
AFX_IDW_TOOLBAR
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.