TreeView CheckBox



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/06/2012 at 13:24, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   12 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    how to getting it working in the treeview checkboxes?
    the other function works in the TreeView, but the function SetCheck does not want.
    does not respond to click

    (Sorry my english)

      
    class FunctionObj : public TreeViewFunctions  
    {  
      public:  
         ................  
      
         virtual LONG IsChecked(void *root,void *userdata,void *obj, LONG lColumn) // for checkboxes (return a combination of LV_CHECKBOX_* or NOTOK if you don't want to show the checkbox)  
         {  
             AcObjNode *node = (AcObjNode* )obj;  
             C4DAtomGoal *link = node->link->GetLinkAtom(NULL);  
      
             if (link)  
             {  
                 GeData data;  
                 if (lColumn=='chk0')  
                 {  
                     link->GetParameter(DescID(COL_CHK_SEP), data, DESCFLAGS_GET_0);  
                     return data.GetBool();  
                 }  
      
                 if (lColumn=='chk1')  
                 {  
                     link->GetParameter(DescID(COL_CHK_INS), data, DESCFLAGS_GET_0);  
                     return data.GetBool();  
                 }  
             }  
             return NULL;  
         }  
      
         virtual void SetCheck(void *root,void *userdata,void *obj, LONG lColumn, Bool bCheck, const BaseContainer& bcMsg) // for checkboxes  
         {  
             //can not get here  
      
                AcObjNode *node = (AcObjNode* )obj;  
             C4DAtomGoal *link = node->link->GetLinkAtom(NULL);  
      
             if (link)  
             {  
                 if (lColumn=='chk0')  
                     link->SetParameter(DescID(COL_CHK_SEP),    GeData((Bool)TRUE),    DESCFLAGS_SET_0);  
                 if (lColumn=='chk1')  
                     link->SetParameter(DescID(COL_CHK_INS),    GeData((Bool)TRUE),    DESCFLAGS_SET_0);  
             }  
         }  
      
        ..................  
    } functable;  
      
    Bool cDlgInstance::CreateLayout(void)  
    {  
      Bool res = GeModalDialog::CreateLayout();  
      res         = LoadDialogResource(DLG_DIN3D_OBJECT, NULL, NULL);  
      
      if (res){  
          tree = (TreeViewCustomGui* )FindCustomGui(IDC_OBJLIST, CUSTOMGUI_TREEVIEW);  
          if (!tree) return FALSE;  
      
          BaseContainer layout;  
          layout.SetLong('chk0',LV_CHECKBOX);  
          layout.SetLong('chk1',LV_CHECKBOX);  
          layout.SetLong('name',LV_TREE);  
          layout.SetLong('cnt0',LV_USER);  
          tree->SetLayout(4,layout);  
      
          tree->SetColumnWidthUser('chk0', 15);  
          tree->SetColumnWidthUser('chk1', 15);  
          tree->SetColumnWidthUser('name', 200);  
          tree->SetColumnWidthUser('cnt0', 50);  
      }  
      
      return res;  
    }  
    

Log in to reply