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 » Seems like something wrong with the command routing. Collapse All
Subject Author Date
David Lee Feb 2, 2007 - 5:11 PM

Hi !!

My MFC application got the following problems.
Basically I followed some of the given examples.

1. Seems like something wrong with the command routing.

For example,     
Since the automatically generated Windows List dialog and menu are not shown,
there may be something wrong with the following.
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)

When the application is being started and only for the first time with all themes except Visual Studio 2005 style,
the following window message is not received.
BEGIN_MESSAGE_MAP(CTraderFormView1, CFormView)
.......
ON_WM_WINDOWPOSCHANGED()
END_MESSAGE_MAP()

The following print preview feature is all right but CTraderFormView1::OnFilePrint method is not called.
Before I added something like class CMainFrame : public CExtNCW < CMDIFrameWnd >, public CExtCustomizeSite,
they worked well.
ON_COMMAND(ID_FILE_PRINT, &CTraderFormView1::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CTraderFormView1::OnFilePrintPreview)

2. The main toolbar is not redrawn (meaning once I’ve repositioned it, it is ok)

3. The automatically generated Windows List dialog and menu are not shown.
It may be caused by inappropriate command routing.



The structure of the application is as follows.

// Maybe the problem is occurred after I added public CExtCustomizeSite.
class CMainFrame : public CExtNCW < CMDIFrameWnd >, public CExtCustomizeSite
class CTraderApp : public CWinApp

BOOL CTraderApp::InitInstance()
{
.........

CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_FXDcodeTraderTYPE,
RUNTIME_CLASS(CTraderDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTraderView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);

pDocTemplate = new CMultiDocTemplate(
IDR_FORMVIEW1_TYPE,
RUNTIME_CLASS(CTraderDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTraderFormView1));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);

..............
}


class CTraderFormView1 : public CExtWS < CExtWA < CExtAFV < CFormView > > >

class CChildFrame : public CExtNCW < CMDIChildWnd >


Thank you very much.

Technical Support Feb 6, 2007 - 4:15 AM

If the problem is caused by an incorrect command routing, you can simply check all the OnCmdMsg() methods in your project. If you call parent class methods or return TRUE or FALSE values, you should not see anything incorrectly drawn in any part of UI.

Unfortunately, the code snippets in your message do not allow us to say what causes the problem. If we look at the whole project, that may help us to say what’s wrong.