Professional UI Solutions
Site Map   /  Register


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 Tech Support » MDI Woes Collapse All
Subject Author Date
Kevin Murray May 5, 2009 - 5:06 PM

Trying to utilize

CExtTabMdiWhidbeyWnd in our MDI based application with dynamic windows.  I’m working my way through most things, but one I haven’t been able to figure out is bugging me.  If I have two dynamic windows of the same type as MDI windows, the tabs will only display the active window’s title.  So, if I have three instances of a given window, each has its own title, what I would expect is this:

|title 1|title 2| title3|

Instead, if you click the middle tab, you get this:

|title 2|title 2|title 2|

And so on.  What am I doing wrong? :) I create the tab window like this:













The MDI windows are from CExtDynamicControlBars that have been told to become documents via ( CExtDynamicControlBar::__EDBS_DOCUMENT, true )


( CExtDynamicControlBar::__EDBS_DOCUMENT, true )

Any help is appreciated.




Technical Support May 7, 2009 - 1:46 PM

We think your OnUpdateFrameTitle() virtual method should invoke the following code finally:

   if( pMainFrame->m_wndMdiTabs.GetSafeHwnd() != NULL )

Kevin Murray May 11, 2009 - 9:31 AM

For what it is worth, I started mostly over again. :) I figured out how to get things working in a sample application that didn’t carry the baggage of our full application.  Now, things seem to work properly in my sample app.  So I’ll have to figure out how to migrate what I have done into our product line.


That said, two questions:

1) How do I get an icon to show up in the MDI windows?

2) How do I get the title-bar right click menu (Dockable, Floating, etc.) on the MDI windows?



Technical Support May 11, 2009 - 11:57 AM

The answer to the first question can be found in the CExtTMWI::OnTabWndQueryItemIcon() virtual method which provides tab items of an MDI tabs control with icons. As you can see, it tries to send the WM_GETICON message to the MDI child frame window. If the ICON_SMALL small 16x16 icon is not returned, then it tries to query the ICON_BIG big 32x32 icon and scale it to 16x16 size which is more friendly to tab items. If the both WM_GETICON message invocations does not return icon, then this method tries to get the icon from window class information of the MDI child frame window. The good style of coding is to assign the small icon to the MDI child frame window when handling its WM_CREATE message.
You can modify the Window menu of the dynamic resizable control bar by overriding the CExtDynamicControlBar::OnInitDbsMenu() virtual method. Your method can invoke the parent class method to construct the default menu and then insert your menu items. The CExtDynamicControlBar::OnInitDbsMenu() virtual method initializes menu command items using the CExtPopupMenuWnd::ItemInsertCommand() method and specifies HWND handle of the CExtDynamicControlBar window as target for the WM_COMMAND messages for menu command items.

Technical Support May 6, 2009 - 12:40 PM

Could you provide more details? Do you change the MDI window titles dynamically? If so, you many need to invoke the CExtTabWnd::UpdateTabWnd() method
to apply title changes immediately. The CExtTMWI::OnTabWndQueryItemText() virtual method provides text for tab items of MDI tab controls. It just tries to find an MFC document object \
and use its document title, then it just gets the caption of the MDI child frame window. We believe there must be a way to reproduce this issue with
the MDI_DynamicBars sample application.

Kevin Murray May 6, 2009 - 1:34 PM

We have the same document, with multiple views.  So, I derived a class from CExtDynamicMDIChildWnd and overrode OnUpdateFrameTitle.  This will ask the current child view (and document) what its title should be.  This title is then set to the frame via SetTitle AND SetWindowText.  GetBar is utilized to set the caption text of the control bar as well (so it stays in sync, should the title change).  Interestingly, the windows themselves have the right title -- it is only the tabs that are changing and incorrect.  So I think my override of OnUpdateFrameTitle is working as it should, but that the tabs aren’t using this title, perhaps? 

Then again, I’m not even sure how the tabs are getting created...