Stack Window | CodeGuru

Stack Window

. Overview on stack window The stack window gives alternative way to manage multiple dialog boxes inside single window (see picture). Unlike standard property sheet control layout of stack window is vertical. Pages are separated with captions. Page captions displays user-defined name and can be clicked to expand/contract the page. If size of stack window exceeds […]

Written By
CodeGuru Staff
CodeGuru Staff
Jul 29, 1999
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

.

Sample Image

Overview on stack window

The stack window gives alternative way to manage multiple
dialog boxes inside single window (see
picture). Unlike standard property sheet control layout of stack window is vertical.
Pages are separated with captions. Page captions displays user-defined name and
can be clicked to expand/contract the page. If size of
stack window exceeds size of parent’s client area user can pan
window contents by clicking and dragging on the whitespace area or
static/disabled control of child dialog box.

How to use stack window in your application

1. Add member variable in your CMainFrame class:



CStackWnd m_wndStack;

2. Create stack window during main frame creation

   int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
   {
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	...
	if (!m_wndStack.Create(NULL, NULL, WS_CHILD | WS_VISIBLE,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0("Failed to create view window\n");
		return -1;
	}

   	...
   }

3. Create dialog box template and dialog box class. Dialog box
should be invisible child.

4. Insert a page into stack window




CDialog* pDlg;
pDlg =
new CMyDialog;

m_wndStack.InsertPage(pDialog, IDD_MY_DIALOG, _T(“My
dialog”),
SWF_VISIBLE);


5. Return to step 3 to add more pages.

Advertisement

Page flags

The combination of following values can be passed to dwFlags
parameter of CStackWnd::InsertPage:

SWF_VISIBLE
Page is visible

SWF_CONTRACTED
Page is contracted (i.e. only caption is visible)

Caution

You should ensure the size of parent window is less or equal
to size of the child stack window.

Downloads

Download demo project - 64 Kb
Download source - 9 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.