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 » CExtControlBar Dialogbox button code execution problem Collapse All
Subject Author Date
Shailesh Nikam Apr 4, 2007 - 9:57 AM

Hi,

I have created one dialog box containg 1 button. I have handled the code for this button by putting messagebox in it. I have put this dialog box on CExtControlBar. When application runs it shows the dialog box on controlbar. But when I click on button its not showing messagebox.
Code of mainframe.cpp and code of dialogbox.cpp is as below

mainframe.cpp->oncreate()

CExtWRB< CExtResizableDialog > m_wndDockedResizableDialog;
if( ! m_wndDockedResizableDialog.Create(
            IDD_DIALOG2,
            &m_wndResizableBarDlg
            )
        )
    {
        TRACE0("Failed to create m_wndResizableBarDlg\n");
        return -1;        // fail to create
    }
    m_wndDockedResizableDialog.ShowSizeGrip( FALSE );

dialogbox.cpp

BEGIN_MESSAGE_MAP(CHello1, CDialog)
    ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
END_MESSAGE_MAP()

// CHello1 message handlers
void CHello1::OnBnClickedButton1()
{
MessageBox(_T("Hello S"));
// TODO: Add your control notification handler code here
}

Suhai Gyorgy Apr 4, 2007 - 12:41 PM

The problem is on this line:
CExtWRB< CExtResizableDialog > m_wndDockedResizableDialog;
This says your dialog is not of class CHello1, but of CExtResizableDialog, thus it won’t have the message map you created for CHello1.
This line should look like: CExtWRB< CHello1 > m_wndDockedResizableDialog;
and your CHello1 class should be derived from CExtResizableDialog. Dont’t forget to use CExtResizableDialog everywhere in dialogbox.cpp where it was CDialog before.

Technical Support Apr 4, 2007 - 12:18 PM

Would you copy your dialog template resource and C++ class into our SDI sample, use it inside some control bar, ensure the problem exists and send this modified sample to us? You can copy the resources your project into our SDI sample application by using drag-and-drop in the resource view window if both projects are inserted into one workspace/solution.