Request: Combobox Icons
-
Hello,
Unless I'm missing something, it seems like Comboboxes/Integer Cycle dropdowns have the option for icons everywhere they appear except in GeDialog. I'd like to request that you add this icon option to the GeDialog please as they are very informative & quickly scannable to the user, particularly with long lists.Thank you!
-
Hi @blastframe,
thank you for reaching out to us. If I am not completely misunderstanding what you are asking for, this is already possible; see attached example at the end of my posting for details. When I did misunderstand you, I would have to ask you to clarify what you mean with "having no options for icons to appear".
Please also remember in the future to add version tags to your postings, as this is often important for our work.
Cheers,
Ferdinand"""An example for a GeDialog with a DTYPE_LONG cycle rendered as a combo-box where entries have icons. As discussed in: https://developers.maxon.net/forum/topic/13099/ Note: This script has been written for R23. To make it run in prior versions, you have to replace the Python 3 style string formating in the lines 35, 36 and 37. """ import c4d class MyDialog (c4d.gui.GeDialog): """A dialog with a DYTPE_LONG cycle element rendered as a combo-box with icons. """ def CreateLayout(self): """Creates the layout of the dialog. """ # Create the combo-box gadget. combo = self.AddComboBox(id=1, flags=c4d.BFH_FIT|c4d.BFH_SCALE) # Adding entries with an icon - you have to use here the ampersand # syntax (other than the tilde syntax you might be used to from # resource files). The syntax is put into the label of the element # and goes like this: # # {Title}&i{Icon-ID}& # # Where you have to replace the curly brackets with your content. The # icon ids have either to be a predefined icon by Cinema or an icon # registered by you. # An entry for the cube, sphere and cone object. self.AddChild(combo, 0, f"Cube&i{c4d.Ocube}&") self.AddChild(combo, 1, f"Sphere&i{c4d.Osphere}&") self.AddChild(combo, 2, f"Cone&i{c4d.Ocone}&") return True if __name__=='__main__': # Little ugly hack to keep an async dialog in a script manager script # alive. Please do not do this in a production environment. Async # dialogs are not meant to be used in such dangling fashion. global dialog dialog = MyDialog() dialog.Open(c4d.DLG_TYPE_ASYNC, xpos=-2, ypos=-2)
-
@zipit Thank you for the reply. That is exactly what I was I was seeking.
I think the documentation for GeDialog.AddChild should explain this ampersand operation as it would be impossible for a developer to know otherwise from just the documentation. It just says:
child (str) – Name of the item to add.
The
iconid
syntax is mentioned in the UserData Properties so the inconsistency is confusing:
I have added the tag you requested.
-
Hi @blastframe,
I would not say that it is impossible to know - 'cause I knew abut it -, but I agree that it is not very well documented. We actually had a similar case a few weeks ago regarding menus, where we already created a task for updating the documentation in this regard (when we have time). I have modified it now so that it does reflect the point brought up by you here.
Regarding the user data editor: While I also agree that having effectively three syntaxes - the code ampersand, the resource tilde and the user data editor semicolon syntax - is quite bad from an useability standpoint, I am afraid that there won't be any changes regarding these syntaxes for backwards compatibility reasons.
Anyways, thanks for your input, we really appreciate this!
Cheers,
Ferdinand -
@zipit "it would be impossible for a developer to know otherwise from just the documentation."
-
@blastframe said in Request: Combobox Icons:
@zipit "it would be impossible for a developer to know otherwise from just the documentation."
Hi @blastframe,
I was just a bit cheeky The C++ GeDialog Manual shows how to embed an icon via its address (which works similarly), but is not a replacement for the Python docs and explaining it properly in one place. So no worries, I agree with you that this should be improved upon.
Cheers,
Ferdinand -
Hi @blastframe,
without further questions or feedback, we will consider this thread as solved by Monday and flag it accordingly.
Cheers,
Ferdinand -
@ferdinand Hi! I don't see this edit in the documentation. When will your changes be reflected?
-
Hi @blastframe,
the Python documentation will be updated in this regard with the release of R24. If you do not have any questions left related to the initial topic we would ask you to mark this topic as solved.
Cheers,
Ferdinand