Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » TabDialogs (FormViews) into a SplitterWnd in a MDI Application Collapse All
Subject Author Date
Ulrich Heinicke Aug 21, 2007 - 9:07 AM

Hi,

i start to move my application from another gui to prof-uis, because i need a more complex grid an resizable dialogs. My application is an MDI application. Every MDI child frame has an splitter wnd. Both splitter wnd holds several form views. (see www.ibh-software.org/mdi.png). My question is how i can insert the tab views into the splitter wnd and what i should better used FormViews or Dialogs?

Thanks

Ulrich

Ulrich Heinicke Sep 10, 2007 - 3:19 AM

The call must be in the function OnCreateClient after create the views and dialogs.
Ulrich

Ulrich Heinicke Sep 10, 2007 - 3:17 AM

I have solved the problem. There must be a call
SetActiveView((CView *)pNewView);

Ulrich Heinicke Sep 7, 2007 - 8:23 AM

For point 2: i remove OnChildActivate and now it works ok.
For point 1: the document title is correctly set. You can see the title into the first top view starting with HSBalken. I have insert you method into my code and find out that after i create a new document the pointer pActiveDoc is NULL. So i wonder where it will be deactivated. Have you a suggestion?

Thanks
Ulrich

Ulrich Heinicke Sep 7, 2007 - 3:46 AM

I have two new problems, when i insert your code into a MDI Tab-application. 1. The window title and the mdi tab text are not updated with the document title (see www.ibh-software.org/mditabs.png). The document title is correctly set, you can see that into the insert view display. You can find the source code of the frame classes and the exe under www.ibh-software.org/mditabs.zip. 2. In my application the child frame is maximize, but when i switch between two documents they will be cascaded. Could you tell me whats going wrong ?

Thanks
Ulrich

Technical Support Sep 7, 2007 - 6:58 AM

1. Here is the method that retrieves text for the MDI tabs. As you can see it has to do with the document title. So, please make sure that you correctly set the document title when creating documents.

virtual __EXT_MFC_SAFE_LPCTSTR OnTabWndQueryItemText(
	const CExtTabWnd::TAB_ITEM_INFO * pTii
	) const
{
	ASSERT_VALID( pTii );
	HWND hWndMdiChild = (HWND)pTii->LParamGet();	
	if( hWndMdiChild != NULL
		&& ::IsWindow(hWndMdiChild)
		)
	{
		CWnd * pWnd = CWnd::FromHandle( hWndMdiChild );
		ASSERT( pWnd != NULL );
		static CString sText;
		sText = _T("");
		if( pWnd->IsKindOf( RUNTIME_CLASS(CFrameWnd) ) )
		{
			CDocument * pActiveDoc =
				((CFrameWnd*)pWnd)->GetActiveDocument();
			if( pActiveDoc != NULL )
				sText = pActiveDoc->GetTitle();
			if( sText.IsEmpty() )
				sText = ((CFrameWnd *)pWnd)->GetTitle();
			if( ! sText.IsEmpty() )
			{
				int nWindow = ((CFrameWnd*)pWnd)->m_nWindow;
				if( nWindow > 0 )
				{
					sText += _T(":");
					CExtSafeString sNo;
					sNo.Format( _T("%d"), nWindow );
					sText += sNo;
				} // if( nWindow > 0 )
			} // if( ! sText.IsEmpty() )
		} // if( pWnd->IsKindOf( RUNTIME_CLASS(CFrameWnd) ) )
		else
			sText = _T("");

		if( sText.IsEmpty() )
		{
			int nTextLen = pWnd->GetWindowTextLength();
			if( nTextLen > 0 )
			{
				pWnd->GetWindowText( sText.GetBuffer( nTextLen+2 ), nTextLen+1 );
				sText.ReleaseBuffer();
			} // if( nTextLen > 0 )
		} // if( sText.IsEmpty() )
		return (sText.IsEmpty()) ? _T("") : ((LPCTSTR)sText);
		
	}
	return NULL;
}
2. it is not clear why you call the CMDIChildWnd::OnChildActivate() in CChildFrame::ActivateFrame()? Simply remove it and let us know if it helped. If the problem persists, we need some project to debug it ourselves. It may be a modified version of one of our samples.

Ulrich Heinicke Aug 28, 2007 - 7:07 AM

I find out that the gripper must be come from the CChilfFrame (class CChildFrame : public CExtWS < CMDIChildWnd >). So i try to insert ShowSizeGrip(FALSE) into the constructor, but the gripper is show. The same when i overwrite Create and insert it there. Where is must insert it to remove the gripper ?

Thanks
Ulrich

Technical Support Aug 30, 2007 - 11:34 AM

If you want to hide the resizing gripper, you should invoke the ShowSizeGrip(FALSE) in the OnCreate() handler method for the WM_CREATE message handler. In the case of CMDIChildWnd-derived classes, you have no reason to use the CExtNCW template class with them because you never see the client area of MDI child frame window (it is completely covered by the view or other window created inside MDI child frame window). So, please simply remove the CExtNCW template class from the CChildFrame class.

Suhai Gyorgy Aug 28, 2007 - 8:39 AM

Just a guess: Do you really need to use CExtWS template for CChildFrame? I think its whole client area is covered by correctly painted children, so skinned background might not be needed at all. But I don’t know the exact situation, so you might have reason to use it.

Ulrich Heinicke Aug 27, 2007 - 2:29 AM

Thanks for the example. I insert that in my mdi project (see www.ibh-software.org/testproject.png) and find a small bug in the lower right corner (see www.ibh-software.org/bug.png). The code i insert is:

BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
    TRACE0("OnCreateClient\n");

    if( ! m_wndSplitter.CreateStatic( this, 2, 1, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, AFX_IDW_PANE_FIRST ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndSplitter.SetRowInfo( 0, 300, 30 );
    m_wndSplitter.SetRowInfo( 1, 300, 30 );

    if( ! m_wndTpcAtTop.Create( &m_wndSplitter, rectDefault, m_wndSplitter.IdFromRowCol( 0, 0 ) ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndTpcAtTop.OrientationSet( __ETWS_ORIENT_TOP );

    pContext->m_pNewViewClass = RUNTIME_CLASS(CPlayEMFView);
    CWnd* pNewView = this->CreateView(pContext);
    VERIFY( m_wndTpcAtTop.PageInsert( pNewView, _T("m_dlgAtTop2") ) );

    if( ! m_dlgAtTop1.Create( IDD_SYSTEMPAGE, &m_wndTpcAtTop ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    VERIFY( m_wndTpcAtTop.PageInsert( &m_dlgAtTop1, _T("m_dlgAtTop1") ) );

    if( ! m_wndTpcAtBottom.Create( &m_wndSplitter, rectDefault, m_wndSplitter.IdFromRowCol( 1, 0 ) ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndTpcAtBottom.OrientationSet( __ETWS_ORIENT_BOTTOM );

    if( ! m_dlgAtBottom1.Create( IDD_GENERALPAGE, &m_wndTpcAtBottom ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    VERIFY( m_wndTpcAtBottom.PageInsert( &m_dlgAtBottom1, _T("m_dlgAtBottom1") ) );

    TRACE0("OnCreateClient Views created\n");

    return TRUE;
}
Do you have a solution to resolve the bug?

Thanks

Ulrich

Technical Support Aug 28, 2007 - 4:43 AM

The CExtWS template class in Prof-UIS implements a skinned dialog background and a resizing gripper in the bottom right corner. This resizing gripper is implemented as a non-rectangular window (a triangle) and looks exactly like on your screenshots. The CExtWS::ShowSizeGrip() method allows you to show/hide this triangular gripper and it is visible initially by default. CExtWS is used as a base class for CExtResizableDialog. Please find all places in your code where you are using CExtResizableDialog and CExtWS and invoke ShowSizeGrip(FALSE) for them.

Ulrich Heinicke Aug 23, 2007 - 1:58 PM

Please make an example with two splitter panes and maybe 2 tab pages in the tab page container. Then i can see how i can build my application with various number of tab pages. By the way, i test now the CExtGrid to change from MFCGridControl (fron CodeProject). Do you have an tutorial for the grid, i like to see how i can receive messages form the grid.

Thanks

Ulrich

Technical Support Aug 24, 2007 - 12:13 PM

Here is the test project that you requested. You can learn how use a grid on a dialog from this project. Please note that our grid classes provide too much possible events including events of more than 30 cell classes. To define messages for all the possible events would not quite ineffective. So we use virtual functions instead. In some cases, you should use your class for overriding its virtual methods. In some more complicated cases you need to code your own cell class or your own data provider class. You can learn about how to use our grids from the FAQ section and this article.

Suhai Gyorgy Aug 24, 2007 - 1:45 AM

Prof-UIS grid does not send grid-specific messages, but uses virtual functions instead. The reason for this: (Support’s post from another thread):
"Prof-UIS includes a quite large number of classes implementing different controls. To define notification messages for all of them would not have been reasonable because MFC dialog designers and Visual Studio Class Wizard do not work with notifications from custom controls. That is why Prof-UIS is using virtual methods instead."

But you can find some "tutorials": There’s one Feature Article Prof-UIS Grid Brief Overview
and there’s also a Data Grid section of FAQ

Ulrich Heinicke Aug 23, 2007 - 1:16 AM

Could you make me an small example for that ?

Thanks

Ulrich

Technical Support Aug 23, 2007 - 12:26 PM

This is not a problem. But please describe the exact UI layout of splitters and number of tab pages in the tab page containers that would allow you to use it in your project.

Technical Support Aug 22, 2007 - 12:38 PM

First of all, please use the CExtSplitterWnd class which is derived from CSplitterWnd and provides a themed look of pane separators. The CExtTabPageContainerWnd class implements a tabbed window container. You should create it inside splitter panes. The dialogs or form views should be created as children of the tab page container and registered in it using the CExtTabPageContainerWnd::PageInsert() method. You can use either dialog and/or form view windows. We prefer not to use form views if they are not needed for MFC’s document/view architecture. Unlike dialogs, form views support scrolling, but this test project demonstrates a scrollable container for themed resizable dialogs including support for control anchoring.