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 » Active Child in MDI Application Collapse All
Subject Author Date
ven rag Nov 23, 2006 - 7:54 AM

Hi,

I working on the MDI Application.In ProfUIS When I have Child frames it looks like Tab window in the MainFrame.
I have to Call a "Function()" Whenever I change the ChildFrame either by Clicking with Mouse on the Name of the
ChildFrame or by Key Board operation (Ctrl+Tab).How to do it.

I have already used OnMDIActivate((BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
and ActiveFrame(int nCmdShow) Both r not working .

Thank u.

ven rag Nov 24, 2006 - 7:05 AM

In OnMDIActivate I have give a MessageBox.This works fine in VC++6.0.But in Visual Studio 2005 (MFC) When I Click the
Child View or Change the Tab (Ctrl+Tab)I don’t the get the MessageBox.I don’ Know What is the problem.As I told u before When I change the Tab using the Mouse Click or Ctrl+tab I have to Call a Function.

Thank u.Below is the Code.

void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
    
    AfxMessageBox(_T("test"));
    CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
    
    // TODO: Add your message handler code here
    
}

Suhai Gyorgy Nov 24, 2006 - 8:15 AM

Here it’s not a good idea to test with MessageBox, as showing the messagebox will deactivate the frame and thus causing another OnMDIActivate call. For testing purposes you should call TRACE0("Test\n"); here, instead of MessageBox. This way, if OnMDIActivate is called, you will see your "Test" text in VS’s output window.

Unfortunately I don’t know why VC++6.0 worked, but VS2005 doesn’t. Have you tried CView::OnActivateView?

Suhai Gyorgy Nov 23, 2006 - 8:10 AM

Check out MSDN on CView::OnActivateView. It is definitely called when changing tabs, but unfortunately it is called many other times as well. Read MSDN for more information about this.