1
Automation Interface, Add-Ins and Tools / AddNew does not create a new Item !
« on: August 29, 2006, 10:14:44 am »
Why I my new element is not in list ??
Element^ CodeViewPackage::AddElementType(Element^ elem, String^ type, String^ name) {
int nb=elem->EmbeddedElements->Count; // old value
//create a new item
Element^% el = safe_cast<Element^>(elem->EmbeddedElements->AddNew(name,”test”));
if (el ==nullptr) {
log->Error("AddElementType failed: element=nullptr!");
return nullptr;
}
el->Update();
elem->EmbeddedElements->Refresh();
int nb2=elem->EmbeddedElements->Count;
// nb2== nb !!!
Element^ CodeViewPackage::AddElementType(Element^ elem, String^ type, String^ name) {
int nb=elem->EmbeddedElements->Count; // old value
//create a new item
Element^% el = safe_cast<Element^>(elem->EmbeddedElements->AddNew(name,”test”));
if (el ==nullptr) {
log->Error("AddElementType failed: element=nullptr!");
return nullptr;
}
el->Update();
elem->EmbeddedElements->Refresh();
int nb2=elem->EmbeddedElements->Count;
// nb2== nb !!!