-
Dynamic Edit Control
i am having a dialog box with two buttons namely
1 CREATBTN
2 SHOWBTN
my request
1 when i click CREATEBTN, i want to create dynamically edit controls
2 when i click SHOWBTN, i want to get the text of all the edit controls,
then show that text as message;
help me please
-
Re: Dynamic Edit Control
Code:
#include <vector>
std::vector<CEdit*> vedit;
int id_counter=10000;
CString str_txt;
put this on your OnCREATEBTN()
to create a edit control on every button click
Code:
CEdit *ed = new CEdit;
ed->Create(WS_VISIBLE,CRect(x,y,x2,y2),this,id_counter);
vedit.push_back(ed);
++id_counter;
you can get the text from a created ctrl this way
Code:
vedit[0]->GetWindowText(str_txt);