Get string value of combo box children



  • On 25/10/2016 at 09:21, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    I have a dynamic combo box that is filled with string values.

    For example:

    AddComboBox(MY_COMBOBUTTON, BFH_LEFT, 160) 
    AddChild(MY_COMBOBUTTON, CUBE, "Cube")      
    AddChild(MY_COMBOBUTTON, SPHERE, "Sphere" ) 
    Etc...

    How can I get the string value of for example the second child.
    In this case Sphere?

    GetString(MY_COMBOBUTTON) or GetString(SPHERE) just gives the numeric string value of the child.

    Of course I can do it by "redo" the dynamic fill, but I would think that there is a way to get the string value of the combo box child.



  • On 26/10/2016 at 03:10, xxxxxxxx wrote:

    Hi,

    it's not possible to get the strings from a ComboBox dialog gadget. Instead I'd go the other way round. Have an array or list with the strings to be used in the ComboBox and use the array index as ID of the children. Then you can simply use the value of the ComboBox to go back into your array and get your string.



  • On 26/10/2016 at 04:16, xxxxxxxx wrote:

    Yes, that is what I am doing, but I thought I could use the storage of the combobox.

    Thanks, Pim


Log in to reply