Get value of chosen Combobox/Dropdown in Layout

On 12/08/2018 at 22:03, xxxxxxxx wrote:

How can I get the value(string) from a combobox dropdown in a layout window?

I can use GetLong to get the subID, but the string and the subId are both created dynamically.

for example if I added the child
self.AddChild(1001,10011,"Circle")
I can get 10011 with self.GetLong(1001)
How would I get "Circle" if I knew the (10011)?

Thank you.

On 13/08/2018 at 02:25, xxxxxxxx wrote:

Hi,

welcome to the Plugin Café forums :slightly_smiling_face:

No, in a GeDialog there's no easy way to get the strings stored in a combobox. Instead I'd do it the other way round. Create a dictionary containing the IDs and strings. Then fill the combobox from this dictionary and when reading the value use the dictionary to look up the string by its ID.

On 13/08/2018 at 07:06, xxxxxxxx wrote:

Ok. That makes sense. Thanks

On 13/08/2018 at 07:16, xxxxxxxx wrote:

Is there a good place to learn about python with C4D besides the documentation, which I find a bit confusing.

On 13/08/2018 at 07:21, xxxxxxxx wrote:

Well, usually I recommend the examples coming with the Python SDK documentation.
On our development blog we once collected a bunch of resources, see post Public Resources for Cinema 4D Plugin Development in Python