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 » Prof-UIS Controls application Collapse All
Subject Author Date
Paolo Giustinoni Sep 1, 2006 - 1:02 PM

I was astonished by your Prof-UIS Controls application, that I decided to recreate your interface in my application.
Because I’m not se expert in the messaging routing in a MFC application, I have a question:
from a CPageBase-derived class (a dialog) I have to notify the main dialog (the dialog that contain the other dialogs) that some event occurs; what is the best way to do this?

Thanks, Paolo

Technical Support Sep 3, 2006 - 1:33 PM

If the CMainDlg and CPageBase classes in your project are defined in the project scope only (like in the ProfUIS_Controls sample), you should use the simplest possible method which is possible if both classes "know" each other:

... CPageBase::SomeMethod( ... )
{
    ((CMainDlg*)GetParent())->SomeMainDialogsMethod( ... );
}
 
... CPageBase::SomeMainDialogsMethod( ... )
{
    ...
}
The only thing is needed in this case is to include headers of two classes into their source files.

If your application implements some pluggable system, i.e. if each CPageBase-derived class is implemented in a separate DLL, then you can either use the same method or implement a window message-based notification and pass parameters as pointers to data structures.