On 16/02/2013 at 12:12, xxxxxxxx wrote:
In order to have reordering in your TreeView affect the OM, you need to fill out the InsertObject() method in your TreeViewFunctions class. This is some code to how I do it - though you may not need the restrictions on Obase or the Select() part:
//*---------------------------------------------------------------------------*
void InsertObject(void* root, void* userdata, void* obj, LONG dragtype, void* dragobject, LONG insertmode, Bool bCopy)
//*---------------------------------------------------------------------------*
{
if (!root) return;
if (dragobject && (dragtype==DRAGTYPE_ATOMARRAY) && ((AtomArray* )dragobject)->GetCount()==1L && ((AtomArray* )dragobject)->GetIndex(0L) && ((AtomArray* )dragobject)->GetIndex(0L)->IsInstanceOf(Obase))
{
BaseObject* dragop = (BaseObject* )((AtomArray* )dragobject)->GetIndex(0L);
if (!((BaseList2D* )obj)->IsInstanceOf(Obase)) return;
BaseObject* op = (BaseObject* )obj;
Matrix merk = dragop->GetMg();
dragop->Remove();
switch (insertmode)
{
case INSERT_BEFORE: dragop->InsertBefore(op); break;
case INSERT_UNDER: dragop->InsertUnder(op); Open(root,userdata,op,TRUE); break;
default: dragop->InsertAfter(op); break;
}
dragop->SetMg(merk);
Select(root,userdata,dragop,SELECTION_NEW);
EventAdd();
}
}