c++ - CTabView syncronize after removeview -
i have been struggling problem weeks. have mdi app, explore style. in right side, have ctabview, has 5 clistviews , 1 cformview. depending on choose in leftview (ctreeview), should remove (or add) formview ctabview.
the ctabview re-arranged drag , drop (you drag ctestformview first tab), , stored in order.
here link have sample project simulates problem:
in left view, have:
as select "without test-form-view" item, ctestformview removed ctabview, using ctabview::removeview.
to reproduce that, can following simple steps:
the "ctestformview" has disappeared ctabview, , first tab selected. right-click on cexplorelistview1, , see context menu of cexplorelistview4, not context menu of cexplorelistview1.
if select treeitem leftview ("with-test-form-view"), add ctestformview, listviews ctabview not redrawn correctly. there bug in ctabview ?
with following code remove view in ctabview:
removeview(ntabindex);
this code used add view ctabview dynamically:
int cexploretabbedview::addview(cruntimeclass* pviewclass, const cstring& strviewlabel, int iindex /*= -1*/, ccreatecontext* pcontext/* = null*/, bool baftercreation/* = false*/) { assert_valid(this); ensure(pviewclass != null); ensure(pviewclass->isderivedfrom(runtime_class(cview))); cview* pview = dynamic_downcast(cview, pviewclass->createobject()); assert_valid(pview); if(! pview->create(null, _t(""), ws_child | ws_visible, crect(0, 0, 0, 0), &m_wndtabs, (uint)-1, pcontext)) { trace1(_t("ctabview:failed create view '%s'\n"), pviewclass->m_lpszclassname); return -1; } cdocument* pdoc = getdocument(); if (pdoc != null) { assert_valid(pdoc); bool bfound = false; (position pos = pdoc->getfirstviewposition();! bfound && pos != null;) { if(pdoc->getnextview(pos) == pview) bfound = true; } if(! bfound) pdoc->addview(pview); } pview->setparent(this); if(baftercreation) pview->sendmessage(wm_initialupdate, 0, 0); m_wndtabs.inserttab(pview, strviewlabel, iindex); int ntabs = m_wndtabs.gettabsnum(); return ntabs - 1; }
could me figure out why removing/adding view ctabview causing problem?
Comments
Post a Comment