SimpleListView and ComboBox

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

On 15/06/2008 at 22:29, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R9-R10.5 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :

---------
With respect to a GeModalDialog:

What do I have to do to initialize a ComboBox? I've tried SetLong(ID, value) and it still comes up blank. All of the children have been added with AddChild().

What do I have to do to select All/None/Toggle in a SimpleListView? I've tried this in Command() for the button being clicked (SelectAll in this case) :

bList.GetSelection(selection);
selection->SelectAll(0L, bpCount-1L);
bList.SetSelection(selection);
bList.DataChanged();

Nothing happens. I've seen similar code in the sdk examples so what's the difference?

The frustration level here after hours of trying to work this out is at about peak boil.

And here is the entire dialog class code:

> //////////////////////////////////////////////////////////////// \> // CreateMasterDialog.cpp \> //////////////////////////////////////////////////////////////// \> // interPoser Pro 'Create Master Dial' Dialog Class \> //////////////////////////////////////////////////////////////// \> // V1.8.6 2008.06.15 Robert Templeton \> //////////////////////////////////////////////////////////////// \> \> // CreateMasterDialog ====================================================================================================== \> enum \> { \>      CMDIALOG_BLIST = 4000L, \>      CMDIALOG_BALL, \>      CMDIALOG_BNONE, \>      CMDIALOG_BTOGGLE, \>      CMDIALOG_MASTERBP, \>      CMDIALOG_NAME, \>      CMDIALOG_MORPHS, \>      CMDIALOG_SCALES, \>      CMDIALOG_ROTS, \>      CMDIALOG_TRANS, \>      CMDIALOG_OK, \>      CMDIALOG_CANCEL, \>      \_cmdialogdummy \> }; \> \> // CLASS: CreateMasterDialog \> class CreateMasterDialog : public GeModalDialog \> { \>      private: \>           SimpleListView          bList; \>           BaseContainer          data; \>           BaseDocument\*          doc; \>           BaseTag\*               ftag; \>           BaseSelect\*               selection; \>           LONG                    masterbp; \>           LONG                    bpCount; \>           // BodyParts to slave Selection set \>           String                    name; \>           Bool                    morphs; \>           Bool                    scales; \>           Bool                    rots; \>           Bool                    trans; \>      public: \>           //\*---------------------------------------------------------------------------\* \>           CreateMasterDialog() \>           //\*---------------------------------------------------------------------------\* \>           { \>                selection =     NULL; \>                masterbp =     0L; \>                bpCount =     0L; \>                morphs = scales = rots = trans = TRUE; \>           } \>           //\*---------------------------------------------------------------------------\* \>           ~CreateMasterDialog() \>           //\*---------------------------------------------------------------------------\* \>           { \>                BaseSelect::Free(selection); \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool CreateLayout() \>           //\*---------------------------------------------------------------------------\* \>           { \>                // Call parent instance \>                if (!GeDialog::CreateLayout()) return FALSE; \>                SetTitle(ftag->GetName()+" - Create Master Dial"); \> \>                GroupBegin(0L,BFH_SCALEFIT|BFV_SCALEFIT,0L,2L,String(),0L); \>                { \>                     GroupBegin(0L,BFH_SCALEFIT|BFV_SCALEFIT,2L,0L,String("Master Configuration"),0L); \>                     { \>                          // MasterDial Configuration \>                          GroupBegin(0L,BFH_SCALEFIT|BFV_SCALEFIT,0L,6L,String("Master Config"),0L); \>                          { \>                               GroupBorder(BORDER_WITH_TITLE|BORDER_GROUP_IN); \>                               GroupBegin(0L,BFH_SCALEFIT|BFV_FIT,2L,0L,String(),0L); \>                               { \>                                    AddStaticText(0L,                    BFH_LEFT|BFV_CENTER, 0L, 0L, "Dial BodyPart", BORDER_NONE); \>                                    AddComboBox(CMDIALOG_MASTERBP,     BFH_LEFT|BFV_CENTER, SizePix(200L), 0L); \>                               } \>                               GroupEnd(); \>                               GroupBegin(0L,BFH_SCALEFIT|BFV_FIT,2L,0L,String(),0L); \>                               { \>                                    AddStaticText(0L,                    BFH_LEFT|BFV_CENTER, 0L, 0L, "Dial Name", BORDER_NONE); \>                                    AddEditText(CMDIALOG_NAME,          BFH_LEFT|BFV_CENTER, SizePix(200L), 0L); \>                               } \>                               GroupEnd(); \>                               AddCheckbox(CMDIALOG_MORPHS,     BFH_LEFT|BFV_CENTER, 0L, 0L, "Morphs"); \>                               AddCheckbox(CMDIALOG_SCALES,     BFH_LEFT|BFV_CENTER, 0L, 0L, "Scales"); \>                               AddCheckbox(CMDIALOG_TRANS,          BFH_LEFT|BFV_CENTER, 0L, 0L, "Translations"); \>                               AddCheckbox(CMDIALOG_ROTS,          BFH_LEFT|BFV_CENTER, 0L, 0L, "Rotations"); \>                          } \>                          GroupEnd(); \>                          // Slave Bodyparts \>                          GroupBegin(0L,BFH_SCALEFIT|BFV_SCALEFIT,0L,2L,String("Slaves from:"),0L); \>                          { \>                               GroupBorder(BORDER_WITH_TITLE|BORDER_GROUP_IN); \>                               // BodyPart ListView \>                               AddListView(CMDIALOG_BLIST,          BFH_SCALEFIT|BFV_SCALEFIT, 0L, SizePix(400L)); \>                               bList.AttachListView(this, CMDIALOG_BLIST); \>                               bList.SetProperty(SLV_MULTIPLESELECTION, TRUE); \>                               // Attributes \>                               GroupBegin(0L,BFH_SCALEFIT|BFV_SCALEFIT,3L,0L,String(),0L); \>                               { \>                                    AddButton(CMDIALOG_BALL,     BFH_LEFT|BFV_CENTER, 0L, 0L, String("All")); \>                                    AddButton(CMDIALOG_BNONE,     BFH_LEFT|BFV_CENTER, 0L, 0L, String("None")); \>                                    AddButton(CMDIALOG_BTOGGLE,     BFH_LEFT|BFV_CENTER, 0L, 0L, String("Toggle")); \>                               } \>                               GroupEnd(); \>                          } \>                          GroupEnd(); \>                     } \>                     GroupEnd(); \>                     // Response \>                     GroupBegin(0L,BFH_CENTER|BFV_FIT,2L,0L,String(),0L); \>                     { \>                          AddButton(CMDIALOG_OK,          BFH_LEFT|BFV_CENTER, 0L, 0L, GeLoadString(IPPS_OK)); \>                          AddButton(CMDIALOG_CANCEL,     BFH_LEFT|BFV_CENTER, 0L, 0L, GeLoadString(IPPS_CANCEL)); \>                     } \>                     GroupEnd(); \>                } \>                GroupEnd(); \> \>                // Master Configuration \>                // - Initialize to root body part \>                SetString(CMDIALOG_NAME,     name); \>                SetBool(CMDIALOG_MORPHS,     morphs); \>                SetBool(CMDIALOG_SCALES,     scales); \>                SetBool(CMDIALOG_TRANS,          trans); \>                SetBool(CMDIALOG_ROTS,          rots); \> \>                // Bodypart ListView \>                data.SetLong('chck',LV_COLUMN_CHECKBOX); \>                data.SetLong('name',LV_COLUMN_TEXT); \>                bList.SetLayout(2, data); \>                bList.DataChanged(); \>                // Add Bodyparts to Bodypart List \>                data.FlushAll(); \>                EnumerateBodyParts(); \>                SetLong(CMDIALOG_MASTERBP,     masterbp, 0L, bpCount); \>                Enable(CMDIALOG_MASTERBP,     TRUE); \> \>                return TRUE; \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool Command(LONG id, const BaseContainer &msg;) \>           //\*---------------------------------------------------------------------------\* \>           { \>                if          (id == CMDIALOG_BALL) \>                { \>                     bList.GetSelection(selection); \>                     selection->SelectAll(0L, bpCount-1L); \>                     bList.SetSelection(selection); \>                     bList.DataChanged(); \>                } \>                else if (id == CMDIALOG_BNONE) \>                { \>                     bList.GetSelection(selection); \>                     selection->DeselectAll(); \>                     bList.SetSelection(selection); \>                     bList.DataChanged(); \>                } \>                else if (id == CMDIALOG_BTOGGLE) \>                { \>                     bList.GetSelection(selection); \>                     selection->ToggleAll(0L, bpCount-1L); \>                     bList.SetSelection(selection); \>                     bList.DataChanged(); \>                } \>                else if (id == CMDIALOG_MASTERBP) \>                { \>                     SetLong(CMDIALOG_MASTERBP, masterbp); \>                } \>                else if (id == CMDIALOG_OK) \>                { \>                     LONG     slaves =          bList.GetSelection(selection); \>                     GetLong(CMDIALOG_MASTERBP,     masterbp); \>                     GetString(CMDIALOG_NAME,     name); \>                     GetBool(CMDIALOG_MORPHS,     morphs); \>                     GetBool(CMDIALOG_SCALES,     scales); \>                     GetBool(CMDIALOG_ROTS,          rots); \>                     GetBool(CMDIALOG_TRANS,          trans); \>                     if (!name.Content())     MessageDialog("No Master Dial Name"); \>                     else if (!slaves)          MessageDialog("No Slave body parts selected"); \>                     else                         Close(TRUE); \>                } \>                else if     (id == CMDIALOG_CANCEL) \>                { \>                     Close(FALSE); \>                } \>                return TRUE; \>           } \>           //\*---------------------------------------------------------------------------\* \>           LONG Message(const BaseContainer& msg, BaseContainer& result) \>           //\*---------------------------------------------------------------------------\* \>           { \>                if (msg.GetId() == BFM_ACTION) \>                { \>                     if (msg.GetLong(BFM_ACTION_ID) == CMDIALOG_MASTERBP) \>                          SetLong(CMDIALOG_MASTERBP, msg.GetLong(BFM_ACTION_VALUE)); \>                } \>                return GeDialog::Message(msg,result); \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool Init(BaseDocument\* t_doc, BaseTag\* t_ftag) \>           //\*---------------------------------------------------------------------------\* \>           { \>                doc =                         t_doc; \>                ftag =                         t_ftag; \>                selection =                    BaseSelect::Alloc(); \>                return (selection != NULL); \>           } \>           // Enumerate BodyParts for selected Figure \>           //\*---------------------------------------------------------------------------\* \>           void EnumerateBodyParts() \>           //\*---------------------------------------------------------------------------\* \>           { \>                BaseContainer\*     bc =     ftag->GetDataInstance(); \>                if (!bc)                    return; \>                IPPFigure\*          ippf =     (IPPFigure\* )ftag->GetNodeData(); \>                if (!ippf)                    return; \>                BaseContainer\*     sbc =     ippf->GetBodyPartContainer(doc, ftag->GetObject(), bc); \>                if (!sbc)                    return; \>                BaseObject\*          obj; \>                bpCount =                    0L; \>                LONG               lm =     bc->GetLong(IPPFIGURE_BPINDEX); \>                // - Retrieve SubContainer for Links to Figure's Body Parts (iPP Bases) \>                for (LONG m = 0L; m != lm; ++m) \>                { \>                     obj =                    sbc->GetObjectLink(m, doc); \>                     if (!obj)               continue; \>                     data.SetBool('chck',     selection->IsSelected(m)); \>                     data.SetString('name',     obj->GetName()); \>                     bList.SetItem(m, data); \>                     AddChild(CMDIALOG_MASTERBP,     m,     obj->GetName()); \>                     ++bpCount; \>                } \>                bList.DataChanged(); \>           } \>           //\*---------------------------------------------------------------------------\* \>           LONG GetMasterBP() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return masterbp; \>           } \>           //\*---------------------------------------------------------------------------\* \>           BaseSelect\* GetSlaves() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return selection; \>           } \>           //\*---------------------------------------------------------------------------\* \>           String GetName() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return name; \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool GetMorphs() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return morphs; \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool GetScales() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return scales; \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool GetRots() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return rots; \>           } \>           //\*---------------------------------------------------------------------------\* \>           Bool GetTrans() \>           //\*---------------------------------------------------------------------------\* \>           { \>                return trans; \>           } \> };

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

On 16/06/2008 at 00:06, xxxxxxxx wrote:

Okay, I figured it out. It was the indices that differed between the body parts and the ListView items. Anybody need hair for a wig? ;)