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

    SetData() with FindCustomGui / CUSTOMGUI_BITMAPBUTTON

    Cinema 4D SDK
    2
    4
    679
    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.
    • lasselauchL
      lasselauch
      last edited by

      Hi there,

      I'm currently having troubles to understand the workflow when using FindCustomGui. I'm currently relying on a Dialog created via ResEdit. Within this Dialog I have a Flushgroup where I create Buttons via AddCustomGui. This works totally fine and I'm able to set different settings via the c4d.BaseContainer.

      However when using FindCustomGui I'm not sure on where I need to use: SetData() to set for example the FORCESIZE of the button to 16.

      Pseudo-Code looks like this:

      bc = c4d.BaseContainer()  # Create a new container to store the button image
      bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True)
      bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, iconid)
      bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, "tooltip")
      bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 16)
      
      button = self.AddCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON, "Title", c4d.BFH_MASK | c4d.BFV_CENTER, 0, 0, bc)
      

      Works like a charm ☝

      button = self.FindCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON)
      # button.GetData() is None.
      button.SetImage(bmp, True)
      

      Even if I create my own c4d.BaseConainer again and setting it via SetData:

      button = self.FindCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON)
      bc = c4d.BaseContainer()
      bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, iconid)
      bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, "tooltip")
      bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 16)
      button.SetData(bc)
      # After button.SetData(bc) button.GetData() is still None..!
      button.SetImage(bmp, True)
      

      This would really save me a lot of pain flushing manually different groups for those bitmapbuttons... Any ideas? What am I doing wrong?

      Cheers,
      Lasse

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hello,

        please use the forum features by setting your thread to a question :
        Q&A New Functionality.

        There's a bit of confusion here.
        You got two things, the data and the UI.

        • When you set your BaseContainer and use it to add a customgui, that basecontainer will be used by the ui.
        • If you use SetData you are defining the data of the parameter.

        For that reason, your last snippet will not work at all.

        You want to change the description of the button. The only way is to flush the group and recreate it with new parameters (size).

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • lasselauchL
          lasselauch
          last edited by

          Thanks, for the answer Manuel. (And sorry about not setting it as a question...)

          Just to make sure, there's no way to flush a single Element and insert at that position, right? It has to be a group?

          Thanks,
          Lasse

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            @lasselauch said in SetData() with FindCustomGui / CUSTOMGUI_BITMAPBUTTON:

            there's no way to flush a single Element and insert at that position, right? It has to be a group

            For what I know, correct.

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

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