visual c++ - Setting Cedit Text -
i have following code in trying set text in cedit text box:
class cmetadlg : public cdialogex { public: cmetadlg(); // dialog data enum { idd = idd_meta }; protected: virtual void dodataexchange(cdataexchange* pdx); // ddx/ddv support // implementation protected: declare_message_map() public: cedit m_author; cedit m_sources; afx_msg void onbnclickedok(); }; cmetadlg::cmetadlg() : cdialogex(cmetadlg::idd) { } void cmetadlg::dodataexchange(cdataexchange* pdx) { cdialogex::dodataexchange(pdx); ddx_control(pdx, idc_author, m_author); ddx_control(pdx, idc_sources, m_sources); } begin_message_map(cmetadlg, cdialogex) on_bn_clicked(idok, &cmetadlg::onbnclickedok) end_message_map() void cemergenceapp::onfilemeta() { cmetadlg md; md.domodal(); md.m_author.setwindowtextw(cemergenceview::getdoc()->author); md.m_sources.setwindowtextw(cemergenceview::getdoc()->sources); }
this gives me debug assertion error. assuming problem lies in lines:
md.m_author.setwindowtextw(cemergenceview::getdoc()->author); md.m_sources.setwindowtextw(cemergenceview::getdoc()->sources);
as commenting them out, works fine.
when call domodal dialog created, edit controls created , when user clicks ok or cancel edit controls , dialog window destroyed. domodal returns. not understand trying trying set edit control's text after dialog box closes.
Comments
Post a Comment