Creating a CDialog containing a Resource-created CFormView on the fly

  • Thread starter Thread starter sbrothy
  • Start date Start date
S

sbrothy

Guest
I¨ve created a CFormView encapsulating a CDialog I created using the Resource Editor.


In the code (A CDOckablePane derivative) I create it on the fly using a CDialog like this:

Code:
m_Dlg.Create(CMyFormView::IDD, this);

m_Dlg.ShowWindow(1);

The CDialog is created and showed to my satisfactu'iob but there the joy stops.

The CMyFormView header contains a Message map declaration:

DECLARE_MESSAGE_MAP()


which is implemented in the source file:

Code:
IMPLEMENT_DYNCREATE(CMyFormView, CFormView)

BEGIN_MESSAGE_MAP(CMyFormView, CFormView)
ON_WM_DESTROY()
ON_WM_CREATE()
ON_BN_CLICKED(IDC_BUTTON_SAVE, OnButtonSave)
ON_BN_CLICKED(IDC_BUTTON_ATTACH, OnButtonAttach)
END_MESSAGE_MAP()

Problem is that the buttons doesnt fire when pressed. Ive tried various permutations along the lines of:


Code:
IMPLEMENT_DYNCREATE(CMyFormView, CFormView)

BEGIN_MESSAGE_MAP(CMyFormView, CFormView)
ON_WM_DESTROY()
ON_WM_CREATE()
ON_BN_CLICKED(IDC_BUTTON_SAVE, &CMyFormView::OnButtonSave)
ON_BN_CLICKED(IDC_BUTTON_ATTACH, &CMyFormView::OnButtonAttach)
END_MESSAGE_MAP()


but nothing seemsto work.


Why wont these buttons respond. I¨ve checked and doublechecked that the IDs are correct, but to no avail.

Why wont this work?


Regards',

Søren.

[url="https://social.msdn.microsoft.com/Forums/en-US/34021849-8be4-48f6-950c-5f559b9f7998/creating-a-cdialog-containing-a-resourcecreated-cformview-on-the-fly?forum=vcgeneral"]Continue reading...[/url]
 
Back
Top