Solved

Title bar will not display in Splitter Window Pane

Posted on 1998-07-09
5
526 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 59
Separate files macro - Errors on larger data set 18 77
Generic progress indicator 6 121
either24  challenge 19 110
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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