Solved

Title bar will not display in Splitter Window Pane

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
building a service to accessed via telnet client, want colors ? 4 88
Line meaning 9 85
how to use laptop or pad camera in vb.net windows application 2 71
Problem to App 4 82
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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