Current Active Tab from TabGroup



  • On 05/08/2016 at 16:03, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   17 
    Platform:    Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Couldn't find the answer to this on the forums or in the SDK examples.

    I have extended the GeDialog class and added a TabGroup to my dialog. Is there a way to figure out what the current active tab is from the Command method? Partial code snippet below:

    #define ID_AOVS_TABS 11021114
    #define ID_AOVS_TABS_STANDARD 11021115
    #define ID_AOVS_TABS_LPE 11021116
    #define ID_AOVS_STANDARD_LIST 11030000
    #define ID_AOVS_LPE_LIST 11031000
    #define ID_AOVS_LISTVIEW 11021120
    #define ID_AOVS_CHANNELS_LISTVIEW 11021122
    #define ID_AOVS_BUTTON_ADDCHANNEL 11021124
      
    class AOVSDialog: public GeDialog
    {
    private:   
        Int32 _lastcoremsg_change;   
      
    public:
        AOVSDialog();
        virtual ~AOVSDialog(void);
        virtual Bool CreateLayout();
        virtual Bool Command(Int32 id,const BaseContainer & msg );
        virtual Bool CoreMessage(Int32 id, const BaseContainer &msg);   
      
    private:
        SimpleListView m_aovListView;
        SimpleListView m_channelListView;    
        SimpleListView m_standardListView;
        SimpleListView m_lpeListView;   
        Int32 m_activeTab;
    };
      
    AOVSDialog::AOVSDialog(void)
    {
        _lastcoremsg_change = NOTOK;
    }
      
    Bool AOVSDialog::CreateLayout()
      
    {    
        SetTitle("Example");
        GroupBegin(1000, BFH_SCALEFIT | BFV_FIT, 3, 0, "", BFV_BORDERGROUP_FOLD_OPEN, 400, 100);
        GroupBorderSpace(10, 10, 10, 10);    
        TabGroupBegin(ID_AOVS_TABS, BFH_SCALEFIT | BFV_SCALEFIT);   
        GroupBegin(ID_AOVS_TABS_STANDARD, BFH_SCALEFIT | BFV_SCALEFIT, 1, 0, "Standard", BFV_BORDERGROUP_FOLD_OPEN, 400, 100);
        AddListView(ID_AOVS_STANDARD_LIST, BFH_SCALEFIT | BFV_SCALEFIT );
        m_standardListView.AttachListView(this, ID_AOVS_STANDARD_LIST);
        layout.SetInt32('name', LV_COLUMN_TEXT);
        m_standardListView.SetLayout(1, layout);
        m_standardListView.SetProperty(SLV_MULTIPLESELECTION, 1);
      
        for (size_t i = 0; i < standardAOVS.size(); ++i)
        {
    	// add stuff to list  
        }
      
        GroupEnd();   
      
        GroupBegin(ID_AOVS_TABS_LPE, BFH_SCALEFIT | BFV_SCALEFIT, 1, 0, "LPE", BFV_BORDERGROUP_FOLD_OPEN, 400, 100);
        AddListView(ID_AOVS_LPE_LIST, BFH_SCALEFIT | BFV_SCALEFIT );
        m_lpeListView.AttachListView(this, ID_AOVS_LPE_LIST);
        layout.SetInt32('name', LV_COLUMN_TEXT);
        m_lpeListView.SetLayout(1, layout);
        m_lpeListView.SetProperty(SLV_MULTIPLESELECTION, 1);
      
        for (size_t i = 0; i < lpeAOVS.size(); ++i)
      
        {
    	// add stuff to list  
        }
      
        GroupEnd();    
        GroupEnd(); // TabGroupBegin
      
        m_activeTab = ID_AOVS_STANDARD_LIST;
      
        AddButton(ID_AOVS_BUTTON_ADDCHANNEL, BFH_LEFT | BFV_CENTER, 0, 10, "Add Channel(s)");
        GroupEnd();
      
    Bool AOVSDialog::Command(Int32 id, const BaseContainer & msg)
    {
        switch(id)
        {
            case (ID_AOVS_TABS) :
            {
    	   // set m_activeTab...how?
                break;
            }
      
        }
    }
    

    Thanks!
    Ian



  • On 05/08/2016 at 16:17, xxxxxxxx wrote:

    Each tab has an ID and you can get the ID of the active tab with GeDialog::GetInt32().

    Cheers,



  • On 08/08/2016 at 09:02, xxxxxxxx wrote:

    Awesome! That worked for me.

    Thanks!
    Ian


Log in to reply