Solved

Title bar will not display in Splitter Window Pane

Posted on 1998-07-09
5
525 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 66
Use of condition with 'serial' in ansible 2 87
Problem to open Excel file 15 220
moto 4g phone enable finger print 4 46
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 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