Solved

Title bar will not display in Splitter Window Pane

Posted on 1998-07-09
5
517 Views
Last Modified: 2013-11-19
I have a splitter window with 2 panes.
I cannot get the dialog displayed in one of the panes to display a title bar.  I have set the title bar checkbox on the styles tab of the dialog properties but it does not display. (Other properties for the dialog include a thin border and the style as child)
0
Comment
Question by:birosra
  • 3
5 Comments
 
LVL 3

Expert Comment

by:danny_pav
ID: 1318920
When you create a dialog resource for a CFormView derived object, there are certain styles that must be set and others that must not be set.  

From MSDN:

Design a dialog template.

Use the dialog editor to design the dialog box. Then, in the Styles and More Styles property pages, set the following properties:


•In the Style box, select Child (WS_CHILD on).
•In the Border box, select None (WS_BORDER off).
•Clear the Visible check box (WS_VISIBLE off).
•Clear the Titlebar check box (WS_CAPTION off).


These steps are necessary because a form view is not a true dialog box.

--
The form's caption is given by the parent, usually some CFrameWnd-derivative.  In your case, the CSplitterWnd is its parent.  

No matter what you do (short of rewriting windows) you will not get a title bar inside the splitter pane.

0
 
LVL 3

Expert Comment

by:danny_pav
ID: 1318921
That should be my answer, sorry.
0
 

Author Comment

by:birosra
ID: 1318922
Before I give up on this,
Would any others like to comment on Danny's response
(agree or have some magical resolution to the problem):
"No matter what you do (short of rewriting windows) you will not get a title bar inside the splitter pane. "
0
 
LVL 2

Accepted Solution

by:
jstolan earned 100 total points
ID: 1318923
Danny is pretty much correct.  However you can easily simulate the caption area.  Simply leave enough room at the top to draw whatever caption you would like.  Then use the WM_PAINT message to draw over the form view.  The code snippet below draws a header that looks like a windows 3d Caption:

void CMyFormView::DrawCaption(CDC * pDC)
{
    CRect rcClient;
    GetClientRect( &rcClient );
    CRect rcDraw = rcClient;
    rcDraw.bottom = rcDraw.top+GetSystemMetrics(SM_CYCAPTION);
    COLORREF clrOldText = pDC->SetTextColor( GetSysColor(COLOR_WINDOWTEXT));
    pDC->FillSolidRect( &rcDraw,GetSysColor(COLOR_3DFACE));
    CPen cBlackPen;
    cBlackPen.CreatePen( PS_SOLID,1, RGB(0,0,0) );
    CPen cShadowPen;
    cShadowPen.CreatePen( PS_SOLID,1,
GetSysColor(COLOR_3DSHADOW));
    CPen cHighLightPen;
    cHighLightPen.CreatePen( PS_SOLID,1,GetSysColor(COLOR_3DHIGHLIGHT) );
    rcDraw.DeflateRect(1,1);
    CPen* pOldPen = pDC->SelectObject( &cShadowPen );
    pDC->MoveTo(rcDraw.left,rcDraw.bottom);
    pDC->LineTo(rcDraw.right,rcDraw.bottom);
    pDC->LineTo(rcDraw.right,rcDraw.top-1);
    pDC->SelectObject( &cHighLightPen );
    rcDraw.InflateRect(1,1);
    pDC->MoveTo(rcDraw.left,rcDraw.bottom);
    pDC->LineTo(rcDraw.left,rcDraw.top);
    pDC->LineTo(rcDraw.right,rcDraw.top);
    pDC->SelectObject( &cBlackPen );
    pDC->MoveTo(rcDraw.left,rcDraw.bottom);
    pDC->LineTo(rcDraw.right,rcDraw.bottom);
    pDC->LineTo(rcDraw.right,rcDraw.top-1);
    pDC->SelectObject( pOldPen );
    cBlackPen.DeleteObject();
    cShadowPen.DeleteObject();
    cHighLightPen.DeleteObject();

    HFONT hSystemFont = (HFONT)GetStockObject( ANSI_VAR_FONT );
    CFont* pFont = CFont::FromHandle( hSystemFont );
    CFont* pOldFont = pDC->SelectObject( pFont );
    pDC->SetBkMode( TRANSPARENT );
    CRect rcTemp = rcDraw;
    pDC->DrawText( _T("My Caption"),&rcTemp,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
    pDC->SetTextColor( clrOldText);
    pDC->SelectObject( pOldFont );
}

Be warned, I edited this from an application I had that did things slightly differently.  There may be a minor glitch or two, but I think you get the idea.  Also note that this will not give you the minimize, maximize or exit buttons used by some caption styles.
0
 
LVL 3

Expert Comment

by:danny_pav
ID: 1318924
What kind of caption will that draw?  Will that draw the old style (Win 3.11, NT 3.51) or the new style (Win 95, NT 4.0)?


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 157
Strange date stored 22 100
Detect CR LF to each line 12 137
Not needed 13 58
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now