Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How could I use the "default window behavior" in initial time ?? Collapse All
Subject Author Date
Jia Hong Li Mar 1, 2007 - 8:40 PM

I dock a toolbar in the bottom of Mainframe[ in function of CMainFrame::OnCreate() ],
so I can initial my application with docking that toolbar in the botom.

My problem:
After I hide that toolbar by any click event, I can’t start my application with default toolbar by rebuild [it is hidden from last time use]
In other words, first time I start my application and I see the toolbar in the bottom, then after I hidden the toolbar, I can’t see the toolbar anymore in initial time

How could I do ?
I just need to see the default window behavior designed by programmer.

Thank for help.

Jia Hong Li Mar 1, 2007 - 8:48 PM

PS:
I can use other method to reach my need,
that is,
1. comment the g_CmdManager->SerializeState() and if( !CExtControlBar::ProfileBarStateLoad ... ).
2. build and run, then get a terrible look interface.
3. uncomment what I comment in step 1.
4. build and run, the I can get the "default window behavior" in initial time.
But this is not a good idea.
How could I do ?

Suhai Gyorgy Mar 2, 2007 - 5:08 AM

g_CmdManager->SerializeState() saves and loads the command usage statistics, so you only need to use that in OnCreate and DestroyWindow if your menu is expanding (initially hides rarely used items (RUI)) or displays RUI in different style.

If you want to keep one of your toolbars (let’s call it m_wndToolBarPersistent) visible and docked to the bottom every time your application is started, your docking code in OnCreate should look like this:

	if( !CExtControlBar::ProfileBarStateLoad(
			this,
			pApp->m_pszRegistryKey,
			pApp->m_pszProfileName,
			pApp->m_pszProfileName,
			&m_dataFrameWP
			)
		)
	{
		DockControlBar( &m_wndMenuBar );
		... // dock all controlbars and toolbars you have, except for m_wndToolBarPersistent
	}
	DockControlBar(&m_wndToolBarPersistent, AFX_IDW_DOCKBAR_BOTTOM);
CExtControlBar::ProfileBarStateSave in DestroyWindow saves all controlbars’, menubar’s and toolbars’ location to the registry, and CExtControlBar::ProfileBarStateLoad loads them in OnCreate. The terrible look interface you mentioned probably came from a previous state saved to the registry, but little messed up. If you clear these saved states from the registry, and start running your application, everything should be fine now. And you can assume that end-users won’t have anything about your application in their registry, when they use your application for the first time.

Another solution would be to prevent the users from modifying your toolbar’s state altogether (keep users from closing it or make it floating).