Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Request: Combobox Icons

    Cinema 4D SDK
    2
    9
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by A Former User

      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!

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by ferdinand

        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)
        

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by A Former User

          @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:
          674f7908-a6ec-4ef8-8ff3-5bd8e23ba066-image.png

          I have added the tag you requested.

          1 Reply Last reply Reply Quote 1
          • ferdinandF
            ferdinand
            last edited by ferdinand

            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

            MAXON SDK Specialist
            developers.maxon.net

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @ferdinand
              last edited by

              @zipit "it would be impossible for a developer to know otherwise from just the documentation."

              ferdinandF 1 Reply Last reply Reply Quote 0
              • ferdinandF
                ferdinand @A Former User
                last edited by

                @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

                MAXON SDK Specialist
                developers.maxon.net

                1 Reply Last reply Reply Quote 0
                • ferdinandF
                  ferdinand
                  last edited by

                  Hi @blastframe,

                  without further questions or feedback, we will consider this thread as solved by Monday and flag it accordingly.

                  Cheers,
                  Ferdinand

                  MAXON SDK Specialist
                  developers.maxon.net

                  ? 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @ferdinand
                    last edited by

                    @ferdinand Hi! I don't see this edit in the documentation. When will your changes be reflected?

                    1 Reply Last reply Reply Quote 0
                    • ferdinandF
                      ferdinand
                      last edited by ferdinand

                      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

                      MAXON SDK Specialist
                      developers.maxon.net

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post