python combobox get current value
OllyFJ last edited by m_magalhaes
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,'______') self.jobs = 'C:/Users/Olly/Downloads/' if os.path.isdir(self.jobs): # add only directories to list i = 0 dirlist = next(os.walk(self.jobs)) dirlist.sort() for d in dirlist: if os.path.isdir(self.jobs+d): i += 1 self.AddChild(J_NAME, i, d)
ferdinand last edited by ferdinand
LONGresource elements, cannot hold a string in Cinema, they will always be of type integer. You can get the value of a
GeDialog.GetInt32(ID_MY_LONG). If you want to react to value changes (when x changed, change y), you have to overwrite
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.
OllyFJ last edited by
@zipit Thanks mate, that's done it!
m_magalhaes last edited by m_magalhaes
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 :)