Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Howto add headers & dividers for a ShowPopupDialog?

    Cinema 4D SDK
    windows s26 python
    4
    13
    1.9k
    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.
    • G
      Gaal Dornik
      last edited by

      Hi, i'm using gui.ShowPopupDialog.

      popup = c4d.BaseContainer()
      popup.SetString(ID_LIVE_SELECTION, "Live Selection")
      result = gui.ShowPopupDialog(cd=None, bc=popup, x=c4d.MOUSEPOS, y=c4d.MOUSEPOS)

      1 Reply Last reply Reply Quote 0
      • G
        Gaal Dornik
        last edited by

        I also would like to know can i add icons to popup menus?

        gheyretG 1 Reply Last reply Reply Quote 0
        • gheyretG
          gheyret @Gaal Dornik
          last edited by

          Hi, @Gaal-Dornik
          Of course you can add header, divider and icon in to Popup dialog.
          this is a simple example for how to add title, separator and icon:

          import c4d
          
          def main() -> None:
              bc = c4d.BaseContainer()
              bc.InsData(c4d.FIRST_POPUP_ID, "item01")
              bc.InsData(c4d.FIRST_POPUP_ID+1, "item02")
              
              # add a title
              bc.InsData(0, "This is Title")
              bc.InsData(c4d.FIRST_POPUP_ID+2, "item03")
              bc.InsData(c4d.FIRST_POPUP_ID+3, "item04")
              
              # add separator
              bc.InsData(0, "")
              bc.InsData(c4d.FIRST_POPUP_ID+4, "item05")
              
              # add icon for an item
              bc.InsData(c4d.FIRST_POPUP_ID+5, f"item06 &i{5140}&")
              bc.InsData(c4d.FIRST_POPUP_ID+6, "item07")
              
              res = c4d.gui.ShowPopupDialog(cd=None, bc=bc, x=500, y=500)
              
          
          if __name__ == '__main__':
              main()
          

          And the result is like this:
          5cfb6134-c84c-47db-b0ec-a045cdc72552-image.png

          You can also visit API Documentation page for more information.

          www.boghma.com

          1 Reply Last reply Reply Quote 2
          • G
            Gaal Dornik
            last edited by

            That's great! Thanks a lot!)

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

              Hello @Gaal-Dornik,

              Thank you for reaching out to us. And thank you @gheyret for providing an answer and solution, I do not really have to add anything here.

              Cheers,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • G
                Gaal Dornik
                last edited by

                BTW Is there a way to remove 'Type to search' at the top of a popup?

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

                  Hello @Gaal-Dornik,

                  I am not quite sure how you mean that. The code example @Gaal-Dornik has provided does not come with the search box (and neither do our code examples). The option has never been documented for Python (I just fixed that) but you must pass POPUP_ALLOW_FILTERING as flag when opening the menu to enable the filtering. To disable filtering, you simply must omit the flag (which is the default).

                  Cheers,
                  Ferdinand

                  Result:
                  916baec0-e41d-4b51-b065-65a63bdf219c-image.png

                  Code:

                  import c4d
                  
                  bc = c4d.BaseContainer()
                  bc.InsData(c4d.FIRST_POPUP_ID, "item01")
                  bc.InsData(c4d.FIRST_POPUP_ID+1, "item02")
                  
                  # add a title
                  bc.InsData(0, "This is Title")
                  bc.InsData(c4d.FIRST_POPUP_ID+2, "item03")
                  bc.InsData(c4d.FIRST_POPUP_ID+3, "item04")
                  
                  # add separator
                  bc.InsData(0, "")
                  bc.InsData(c4d.FIRST_POPUP_ID+4, "item05")
                  
                  # add icon for an item
                  bc.InsData(c4d.FIRST_POPUP_ID+5, f"item06 &i{5140}&")
                  bc.InsData(c4d.FIRST_POPUP_ID+6, "item07")
                  
                  # Redefine the default flags and add the flag which enables the serach box.
                  flags: int = c4d.POPUP_RIGHT | c4d.POPUP_EXECUTECOMMANDS | c4d.POPUP_ALLOW_FILTERING
                  
                  res = c4d.gui.ShowPopupDialog(cd=None, bc=bc, x=500, y=500, flags=flags)
                  
                  

                  MAXON SDK Specialist
                  developers.maxon.net

                  1 Reply Last reply Reply Quote 0
                  • G
                    Gaal Dornik
                    last edited by

                    That's indeed strange because i haven't included this flag for sure, but i can see this field at the top...

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

                      Hey @Gaal-Dornik,

                      I just tried it on S26.1 and I have the filtering there too no matter what I do:

                      3fc5b6b1-5d62-41dc-9303-bcebd03f61b4-image.png

                      Must have been a bug of S26. I do not see much what you can do here.

                      Cheers,
                      Ferdinand

                      MAXON SDK Specialist
                      developers.maxon.net

                      1 Reply Last reply Reply Quote 0
                      • G
                        Gaal Dornik
                        last edited by

                        Actually i've got 'Type to search' popup field in C4D 2023.2.0 also, but POPUP_ALLOW_FILTERING flag is omitted.
                        Is there a way to hide it?

                        1 Reply Last reply Reply Quote 0
                        • G
                          Gaal Dornik
                          last edited by

                          It works as expected in C4D 2024, but not in the previous versions.

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