Solved python combobox get current value

Hey, fairly basic question but I'm pretty new to this and struggling to solve it, I'm trying to write a save script in python, I've filled a combo box with a list of directories, I need to access the string of the currently selected value to link to a second combobox to search for the next folder in the chain, how would I go about doing this? in Houdini I have the same tool working using 'self.ui.jobID.currentText() ' is there a similar function in c4d?

 self.AddComboBox(J_NAME, c4d.BFH_SCALEFIT, initw=300, inith=10)
 self.AddChild(J_NAME,0,'______') = 'C:/Users/Olly/Downloads/'
        if os.path.isdir(
            # add only directories to list
            i = 0
            dirlist = next(os.walk([1]
            for d in dirlist:
                if os.path.isdir(
                    i += 1                   
                    self.AddChild(J_NAME, i, d)



comboboxes, i.e. LONG resource elements, cannot hold a string in Cinema, they will always be of type integer. You can get the value of a LONG element with GeDialog.GetInt32(ID_MY_LONG). If you want to react to value changes (when x changed, change y), you have to overwrite GeDialog.Command().

So if you want to store stuff by their string in a combobox and read the value back, you have to use your own hash table for the mapping.


MAXON SDK Specialist

@zipit Thanks mate, that's done it!


For your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.

I've already done for this thread.

I can just confirm what @zipit said. Nothing to add :)


MAXON SDK Specialist

MAXON Registered Developer