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 General Discussion » Maximizing CExtControlBar to fit CMDIChildWnd client area Collapse All
Subject Author Date
Asmir Mehic Nov 23, 2003 - 2:05 PM

I have 2 CExtControlBar bars inside a maximized CMDIChildWnd.
One of the bars containes some controls (listbox, editbox,static...) while the other has a CEdit for trace output.
What I need is to have the first bar docked to the right side of the frame with a preset default size so the controls fit in nicely, and the other bar should fit in the left over visible client area of the frame window. Both bars should cover the frame window competely.
When I dock the first bar to the right side and the second bar to the left I have some empty frame client area between them and I can’t find a way to make the second bar resize itself to fill it.
The size of the visible frame depends on the screen resolution.

Sergiy Lavrynenko Nov 24, 2003 - 1:38 AM

Dear Asmir,

I don’t see any reason for covering MDI child frame’s area with bars completely, but it’s possible:

	// first, re-compute current layout
	RecalcLayout();
	// rcFreeClient will contain frame’s area
	// which is free of any bars
	CRect rcFreeClient;
	CWnd::RepositionBars(
		0,
		0x0FFFF,
		AFX_IDW_PANE_FIRST,
		CWnd::reposQuery,
		&rcFreeClient,
		&rcFreeClient,
		TRUE
		);
	// compute desired widths of your left/right bars to
	// cover all the rcFreeClient area
	// (my sample code will use half parts) 
	INT nRightWidth = rcFreeClient.Width() / 2;
	INT nLeftWidth = nRightWidth;
	// Dock both resizable bars
	m_wndBarAtRight.SetInitDesiredSizeVertical(
		CSize( nRightWidth, 32767 )
		);
	m_wndBarAtRight.DockControlBar(
		AFX_IDW_DOCKBAR_RIGHT,
		1
		);
	m_wndBarAtLeft.SetInitDesiredSizeVertical(
		CSize( nLeftWidth, 32767 )
		);
	m_wndBarAtLeft.DockControlBar(
		AFX_IDW_DOCKBAR_LEFT,
		1
		);
	// that’s all :-)