I’m very new in c++ programming, but perhaps anybody can help me witdh my questions about dialogs and Prof-UIS:
I’ve got a SingleDocTemplate-project width CMainDoc,CMainFrame and CMainView, now I want to use Prof-UIS to output a dockable Dialog.
First I’ve created a Dialog (IDD_RESIZABLE1) width the Ressource-Editor and inserted some buttons (e.g.: IDC_BUTTON_FROM).
Then I wrote the Create-Part in MainFrm.cpp, but now I want to change e.g. a picture in the Dialog after someone pushed the button.
So my question: how do I link the button e.g. width "void CMainView::OnButtonFromPushed()"?
If the button is part of a toolbar, everything is ok and something happens, but if the button is part of a dialog nothing happens!
here’s the code for the project:
in MainFrm.h:
protected:
CExtControlBar m_wndResizableBar1;
CExtResizableDialog m_dlgForResizable;
CExtButton m_ButtonCombiFrom;
in MainFrm.cpp:
// to create the dialog from ressource:
if( !m_wndResizableBar1.Create(
NULL, // _T("Optional control bar caption"),
this,
IDD_RESIZABLE1
)
)
{
TRACE0("Failed to create m_wndResizableBar1\n");
return -1; // fail to create
}
if( !m_dlgForResizable.Create(
IDD_RESIZABLE1,
&m_wndResizableBar1
)
)
{
TRACE0("Failed to create m_dlgForResizable\n");
return -1; // fail to create
}
// and for the new button-style:
VERIFY(
m_ButtonCombiFrom.SubclassDlgItem(
IDC_BUTTON_FROM,
&m_dlgForResizable
)
now my problem: how can I use this button in MainView.cpp ?
I tried it there width:
BEGIN_MESSAGE_MAP(CMainView, CView)
//{{AFX_MSG_MAP(CMainView)
ON_COMMAND(IDC_BUTTON_FROM, OnButtonFrom)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
but only if the IDC_... is part of a Toolbar something happens.
Perhaps it’s the wrong way to read the IDD_RESZIABLE1 in MainFrm and it’s better to use something like a view.
I found a code in StatusPanes, maybe there’s a way to use that for the problem:
m_pWndView = new CChildFormView;
if (!m_pWndView->Create(
NULL,
NULL,
AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0),
this,
AFX_IDW_PANE_FIRST,
NULL)
)
{
TRACE0("Failed to create view window\n");
return -1;
}