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 » Control Bar: floating state vs. docked state inside floating CMiniFrameWnd Collapse All
Subject Author Date
Suhai Gyorgy Jun 6, 2006 - 8:17 AM

Dear Support,

I encountered 3 problems while trying to see differences between the two Control Bar states stated above. I’m especially interested in the case where, even though the Control Bar is in docked state in floating CMiniFrame, it is the only visible bar and all other "sibling" Control Bars are invisible.

1.) When I use CExtWRB template to add a thin border, the border is drawn differently in the 2 above mentioned states. I think they should look the same.
ScreenShot: Float-vs-Docked-in-Mini.jpg

2.) At program startup the control bars in floating state are drawn when program passes through CMainFrame::OnCreate (before MainFrame appears), but the control bars in docked state inside floating CMiniFrameWnd are drawn only after main application’s InitInstance call is finished. This is disturbing when I have a login dialog, whose DoModal is called from inside InitInstance but after m_pMainWnd->ShowWindow()... If I have 2 control bars, each of them in those 2 different states, the floating one appears when login dialog appears, but the other appears only after login dialog is closed. How could I make all control bars appear at the same time, preferably after login dialog closed (after InitInstance)

3.) I ran into an assertion in ProfileBarStateSave when closing application right after doing this:
I have 2 control bars, each of them in the above mention 2 states. I start dragging the one in "docked state inside MiniFrame" and drag it inside the other control bar and tabbed-docking them together.

Call Stack:
MyProg.exe!CExtControlBar::InternalDockStateBar::StateGet(CExtControlBar * pBar=0x016b6fd8, CExtControlBar::InternalDockStateBar * pParentState=0x00000000) Line 3104 + 0x2a
MyProg.exe!CExtControlBar::InternalDockStateSite::AppendFloatingLayout(CExtMiniDockFrameWnd * pMiniFrame=0x016b7660) Line 2450
MyProg.exe!CExtControlBar::InternalDockStateSite::StateGet() Line 2217
MyProg.exe!CExtControlBar::InternalFriendlyFrameWnd::GetDockState(CExtControlBar::InternalDockStateSite & state={...}) Line 1793
MyProg.exe!CExtControlBar::ProfileBarStateSerialize(CArchive & ar={...}, CFrameWnd * pFrame=0x01671748, tagWINDOWPLACEMENT * pFrameWp=0x0167181c, bool bSerializeFixedBarsState=true, bool bSerializeResizableBarsState=true, bool bEnableThrowExceptions=false) Line 4189
MyProg.exe!CExtControlBar::ProfileBarStateSave(CFrameWnd * pFrame=0x01671748, const unsigned short * sSectionNameCompany=0x011bf9a0, const unsigned short * sSectionNameProduct=0x011bf7f0, const unsigned short * sSectionNameProfile=0x011bf7f0, tagWINDOWPLACEMENT * pFrameWp=0x0167181c, bool bSerializeFixedBarsState=true, bool bSerializeResizableBarsState=true, HKEY__ * hKeyRoot=0x80000001, bool bEnableThrowExceptions=false) Line 1270 + 0x20    C++



Thank you for your help,
Chris

Technical Support Jun 6, 2006 - 11:20 AM

The resizable control bars in any state are managed by a tree-like data structure which contains a set of windows derived from the CExtControlBar and CExtDockBar classes. The CExtControlBar windows are either CExtControlBar objects, instances of the CExtDynamicControlBar class which implements the dynamic resizable control bar controlled by the dynamic bar site, CExtDynControlBar windows created on-the-fly to implement rows and/or columns of bars inside other rows and/or columns of bars and CExtDynTabControlBar windows also created on-the-fly to implement tabbed bar groups. You can get the real picture of the resizable control bars’ layout if you compile Prof-UIS when the following lines are un-commented in the ...\Prof-UIS\Src\ExtDockBar.h file:

//#define __DEBUG_PAINTING_AREAS_DOCKBAR__
//#define __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__


You will see yellow and magenta borders around container windows. This means the sibling term is not well applicable to any kind of resizable control bar in any state. The resizable bars both in Prof-UIS and in Microsoft applications hardly depend on each other. It is hardly possible to specify the location and size of one bar without knowing how it depends on other bars.

You should not have any problems with loading the state of resizable bars. Please ensure you are invoking the CExtControlBar::ProfileBarStateLoad() method in your CMainFrame::OnCreate() method and docking the bars initially only if the bars’ state is failed to be loaded.

We need additional information about the third question. The call stack looks like accessing a control bar which is just created inside the main frame window but not correctly initialized (i.e. is not enabled for re-docking or has a non-unique dialog control identifier). We need to take a look at least at the CMainFrame::OnCreate() and CMainFrame::DestroyWindow() methods which create control bars, load and save their states.

Please also let us know which Prof-UIS version you are using.

Suhai Gyorgy Jun 7, 2006 - 6:56 AM

I made a little sample with Prof-UIS AppWizard and I could reproduce all problems described in this thread and even the problem described in the thread below. Here are the OnCreate and DestroyWindow methods of that sample, but I’m also sending the whole project to you soon by e-mail.

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
CWinApp * pApp = ::AfxGetApp();
	ASSERT( pApp != NULL );
	ASSERT( pApp->m_pszRegistryKey != NULL );
	ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
	ASSERT( pApp->m_pszProfileName != NULL );
	ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
	pApp;

	if (CExtNCW < CFrameWnd >::OnCreate(lpCreateStruct) == -1) return -1;

	VERIFY(g_CmdManager->ProfileWndAdd(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, GetSafeHwnd()));
	VERIFY(g_CmdManager->UpdateFromMenu(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, IDR_MAINFRAME));
 //PROJTYPE_MDI

	// create a view to occupy the client area of the frame
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{ TRACE0("Failed to create view window\n"); return -1;}

	if(	!m_wndMenuBar.Create(NULL, this, ID_VIEW_MENUBAR,
				WS_CHILD|WS_VISIBLE	|CBRS_TOP|CBRS_TOOLTIPS|CBRS_GRIPPER
				|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE )
		) { TRACE0("Failed to create menubar\n"); return -1; }
	
	if(	!m_wndToolBar.Create(NULL, this, AFX_IDW_TOOLBAR,
			WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER|CBRS_FLYBY|CBRS_SIZE_DYNAMIC
			|CBRS_TOOLTIPS|CBRS_HIDE_INPLACE
			) || !m_wndToolBar.LoadToolBar( IDR_MAINFRAME )
		)
	{ TRACE0("Failed to create toolbar\n");	return -1; }

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
	{ TRACE0("Failed to create status bar\n"); return -1; }
//__PROFUISAPPWIZ_KEY_RCB2

	m_wndResizableBarTree.SetInitDesiredSizeVertical(CSize(200, 400));
	m_wndResizableBarTree.SetInitDesiredSizeHorizontal(CSize(400, 200));
	m_wndResizableBarTree.SetInitDesiredSizeFloating(CSize(200, 200));
	if(	!m_wndResizableBarTree.Create(NULL,	this, ID_VIEW_RESIZABLEBAR_TREE,
			WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS|CBRS_FLYBY
				|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE)
		)
	{ TRACE0("Failed to create m_wndResizableBarTree\n"); return -1; }
	if( !m_wndDockedCtrlTree.Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
			|TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT,
			CRect(0,0,0,0),	&m_wndResizableBarTree,	m_wndResizableBarTree.GetDlgCtrlID())
		)
	{ TRACE0("Failed to create m_wndDockedCtrlTree\n");	return -1; }
	m_wndDockedCtrlTree.SetFont(CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)));

	HTREEITEM htiAtLevel0 =	m_wndDockedCtrlTree.InsertItem(_T("Item 1-1"));
	ASSERT( htiAtLevel0 != NULL );
//__PROFUISAPPWIZ_KEY_RCB3

	m_wndResizableBarEdit.SetInitDesiredSizeVertical(CSize(200, 400));
	m_wndResizableBarEdit.SetInitDesiredSizeHorizontal(CSize(400, 200));
	m_wndResizableBarEdit.SetInitDesiredSizeFloating(CSize(200, 200));
	if(	!m_wndResizableBarEdit.Create(NULL, this, ID_VIEW_RESIZABLEBAR_EDIT,
			WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS
				|CBRS_FLYBY|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE)
		)
	{ TRACE0("Failed to create m_wndResizableBarEdit\n"); return -1; }
	if( !m_wndDockedCtrlEdit.Create(WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_LEFT,
			CRect(0,0,0,0),	&m_wndResizableBarEdit,	m_wndResizableBarEdit.GetDlgCtrlID())
		)
	{ TRACE0("Failed to create m_wndDockedCtrlEdit\n");	return -1; }
	m_wndDockedCtrlEdit.SetFont(CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)));
	m_wndDockedCtrlEdit.SetWindowText(_T("Edit control\r\n"));

	m_wndResizableBarDlg.SetInitDesiredSizeVertical(CSize(200, 400));
	m_wndResizableBarDlg.SetInitDesiredSizeHorizontal(CSize(400, 200));
	m_wndResizableBarDlg.SetInitDesiredSizeFloating(CSize(200, 200));
	if(	!m_wndResizableBarDlg.Create(NULL, this, ID_VIEW_RESIZABLEBAR_DLG,
			WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS
				|CBRS_FLYBY|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE)
		)
	{ TRACE0("Failed to create m_wndResizableBarDlg\n"); return -1;	}
	if( !m_wndDockedResizableDialog.Create(IDD_DIALOG_FOR_RESIZABLE_BAR, &m_wndResizableBarDlg))
	{ TRACE0("Failed to create m_wndResizableBarDlg\n"); return -1;	}
	m_wndDockedResizableDialog.ShowSizeGrip( FALSE );
	m_wndDockedResizableDialog.AddAnchor(IDC_EDIT_IN_RESIZABLE_FORM, __RDA_LT, __RDA_RT);
	VERIFY(	m_wndEditInDockedDlg.SubclassDlgItem(IDC_EDIT_IN_RESIZABLE_FORM, &m_wndDockedResizableDialog));

	// TODO: Delete these lines if you don’t want the dockable entity
	m_wndMenuBar.EnableDocking( CBRS_ALIGN_ANY );
	m_wndToolBar.EnableDocking( CBRS_ALIGN_ANY );
	m_wndResizableBarTree.EnableDocking( CBRS_ALIGN_ANY );
	m_wndResizableBarEdit.EnableDocking( CBRS_ALIGN_ANY );
	m_wndResizableBarDlg.EnableDocking( CBRS_ALIGN_ANY );
	// Enable control bars in the frame window to be redocable
 //VERBOSE
	if( !CExtControlBar::FrameEnableDocking(this) )
	{ ASSERT( FALSE ); return -1; }

	if (!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey,
			pApp->m_pszProfileName,	pApp->m_pszProfileName,	&m_dataFrameWP))
	{
		DockControlBar( &m_wndMenuBar );
		DockControlBar( &m_wndToolBar );

		ShowControlBar(&m_wndResizableBarTree, false, false);
		ShowControlBar(&m_wndResizableBarEdit, false, false);
		ShowControlBar(&m_wndResizableBarDlg, false, false);

		m_wndResizableBarTree.FloatControlBar();
		
		m_wndResizableBarTree.DockControlBarIntoTabbedContainer(&m_wndResizableBarEdit, -1, this, false);
		m_wndResizableBarEdit.DockControlBarIntoTabbedContainer(&m_wndResizableBarTree, -1, this, false);
		m_wndResizableBarTree.DockControlBarIntoTabbedContainer(&m_wndResizableBarDlg, -1, this, false);
	}

static UINT statBasicCommands[] =
{
	ID_APP_EXIT,
	ID_APP_ABOUT,
	ID_EDIT_COPY, 
	ID_EDIT_CUT, 
	ID_EDIT_PASTE, 
	ID_EDIT_UNDO, 
	ID_VIEW_TOOLBAR, 
 //TOOLBAR
	ID_VIEW_RESIZABLEBAR_TREE,
	ID_VIEW_RESIZABLEBAR_EDIT,
	ID_VIEW_RESIZABLEBAR_DLG,
	0 // end of commands list
}; // statBasicCommands array

	VERIFY(	g_CmdManager->SetBasicCommands(	__PROF_UIS_PROJECT_CMD_PROFILE_NAME, statBasicCommands));

	g_CmdManager->SerializeState(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, 
		pApp->m_pszRegistryKey,	pApp->m_pszProfileName, false);

	return 0;
}



BOOL CMainFrame::DestroyWindow() 
{
CWinApp * pApp = ::AfxGetApp();
	ASSERT( pApp != NULL );
	ASSERT( pApp->m_pszRegistryKey != NULL );
	ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
	ASSERT( pApp->m_pszProfileName != NULL );
	ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
	pApp;

	VERIFY(	CExtControlBar::ProfileBarStateSave( this,
			pApp->m_pszRegistryKey,	pApp->m_pszProfileName,
			pApp->m_pszProfileName, &m_dataFrameWP ));

	g_CmdManager->ProfileWndRemove( GetSafeHwnd() );
	
	return CExtNCW < CFrameWnd >::DestroyWindow();
}


I’m using ProfUIS254sud.lib, VS2003 (7.1), WinXP. This lib I made with the installation package of Prof-UIS 2.54, but after making this sample’s project-skeleton with Prof-UIS AppWizard, I had to change a setting in the sample’s project properties (along with changing from Multibyte charset to Unicode: "Treat wchar_t as Built-in Type" had to be set to "No". I hope I gave you all the information needed.

Thank you,
Chris.