c++ - Focus not changing upon tab key in a nested CWnd-Derived Class -


environment: vs2013, mfc, c++

i have cdialog derived dialog 2 static buttons (ok, cancel), created dialog editor. additionally dialog should contain dynamically created instance of cwnd-derived class, contains 2 edit boxes.

problem cannot move focus via tab-key between edit boxes , cannot make 1 of boxes have initial focus when opening dialog. when hit tab key 1st editbox gets focussed , point on can't move focus tab key away (clicking mouse works).

i created cwnd ws_ex_controlparent style, still doesn't work move focus. where's problem? i've done far:

//the cdialog-class should container cwnd //.h class cdlgselcatalogitem : public cdialog {    clistfilterinput _ctrllist; //cwnd-derived, contains 2 edit-boxes }  //.cpp bool cdlgselcatalogitem::oninitdialog() {    crect rectlist(10, 10, 100, 50);    _ctrllist.create(rectlist, this); }  //the cwnd-derived class contains 2 edit-boxes //.h class clistfilterinput : public cwnd {    bool create(const rect& rect, cwnd* pparentwnd);     //2 edit-boxes       cedit _ctrl1;    cedit _ctrl2; }  bool clistfilterinput::create(const rect &rect, cwnd *pparentwnd) {    bool bretval;     bretval = cwnd::createex(ws_ex_controlparent, null, _t(""), ws_childwindow | ws_visible,       rect, pparentwnd, ctrl_id_this);     if (bretval == true){     //1st box     crect recttextbox = ...; //calculate rect fox box      bretval = _ctrl1.create(         ws_childwindow | ws_visible | ws_tabstop | es_left | es_autohscroll,         recttextbox, this, ctrl_id_textbox);      //2nd box above 1st     recttextbox.movetoy(recttextbox.top - recttextbox.height());     bretval = _ctrl1.create(         ws_childwindow | ws_visible | ws_tabstop | es_left | es_autohscroll,         recttextbox, this, ctrl_id_textbox+1);        //set input-focus on 1st textbox - doesnt work       _ctrl1.setfocus();    }     return bretval; } 

menu->format->tab order(ctrl + d) thing provide tab order of dialog. once set order click outside dialog.i hope help


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -