THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/12/2012 at 09:42, xxxxxxxx wrote:
INFO : C4d r14, Windows Vista 64, Python
hm,
sorry it is me again :) Is it possible possible to fill a GeDialog ComboBox dynamically with
children / entries after the execution of GeDialog.CreateLayout() ? I have got the
following :
# dialogContainer is a BaseContainer containg the current dialog settings
# self.Presets is a BaseContainer containing several Bc of the same structure
# cHelp is a namespace to some c4d related methods. the whole chain is called
# from GeDialog.Command() :
#
# the bc is saved to file ...
# --------------------------------------------------------------------------------------------------------------
def savePreset(self, dialogContainer) :
presetName = c4d.gui.InputDialog('Preset name:','myPreset {0}'.format(len(self.Presets)))
dialogContainer.SetString(1000, presetName)
self.Presets.SetContainer(1000 + len(self.Presets), dialogContainer)
result = cHelp.SaveHyperFile(self.Presets, self.PresetFilePath, self.HyperKey, True)
if(result) :
self.fillComboBox()
print self.SetLong(srCon.IDC_PRESET_COMBOBOX, len(self.Presets))
return result
# and loaded back here. the ccombox is populated with the new preset names
# --------------------------------------------------------------------------------------------------------------
def fillComboBox(self) :
result = cHelp.ReadHyperFile(self.PresetFilePath, self.HyperKey, True)
if(type(result) == c4d.BaseContainer) :
self.Presets = result
self.FreeChildren(srCon.IDC_PRESET_COMBOBOX)
counter = 0
for item in self.Presets:
# here i am adding the children, and trying to tell c4d that something had changed.
# had the flush and changed thingie on a higher level first, but then moved them here
# to be ultrasafe.
self.LayoutFlushGroup(srCon.IDC_PRESET_COMBOBOX)
self.AddChild(srCon.IDC_PRESET_COMBOBOX , counter, item[1].GetString(1000))
self.LayoutChanged(srCon.IDC_PRESET_COMBOBOX)
return True
else:
return False
I am feeling pretty lazzy for just asking again, but i am not sure what is going wrong there.
When i execute the plugin, everything works as expected. I save the dialog settings to a
hyper file and load the content back from the hyperfile. The combobox is also populated as
expected with my preset names, BUT i cannot visually select anything except the first child.
Programmatically i can set the combobox to any value i want and is also accepted and
returned correctly (but also not reflected in the gui).
thanks for your help, as always.