C++ can't display ActiveX control in the dialog CFormView, control variable is NULL -


i use smartgraph activex control in project (visual studio 2015, mfc, c++). has been registered successfully. try fit dialog control cformview

myappview.h:

#pragma once #include "smartgraph.h" #include "afxwin.h"  class cmyappview : public cformview { protected: // create serialization     cmyappview();     declare_dyncreate(cmyappview)      enum { idd = idd_dialog1 };      csmartgraph m_graph; //!!!!! activex control variable     cbutton m_ctrlok; .... } 

myappview.cpp:

....  void cmyappview::dodataexchange(cdataexchange* pdx) {     cformview::dodataexchange(pdx);     ddx_control(pdx, idok, m_ctrlok);     ddx_control(pdx, idc_smartgraph1, m_graph); }  void cmyappview::oninitialupdate() {     cformview::oninitialupdate();     resizeparenttofit();      m_graph.setparentwnd(this->m_hwnd);     m_graph.setplottype(0);     m_graph.put_xlable(_t("time"));     m_graph.put_ylable(_t("amplitude"));     m_graph.put_title(_t("graph test")); } ... 

so m_graph null , smartgraph isn't displayed in dialog. @ same time ok button variable isn't null , displayed correctly. wrong?

you need create instance of object. m_graph.createcontrol(...);


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -