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
    • Recent
    • Tags
    • Users
    • Login

    Retrieving Listbox Information [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 298 Views
    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.
    • H Offline
      Helper
      last edited by

      On 10/12/2014 at 17:44, xxxxxxxx wrote:

      The documentation for how to .GetLink () is confusing. It says I need an instance of a LinkboxUI.

      I don't know how to retrieve what's contained in the linkbox. Would I need to create the LinkBoxUI instance? If so, how exactly do you do that?

      Simple code setup for the UI. Linkbox and a button. Press the button, print what's in the linkbox (well, that's the goal).

      import c4d
      from c4d import gui
        
      class guiDialog ( gui.GeDialog ) :
          lb = 1000
          btn = 1001
        
          def CreateLayout ( self ) :
              self.AddCustomGui ( self.lb, pluginid = c4d.CUSTOMGUI_LINKBOX, name = "Target Object", flags = c4d.BFH_SCALEFIT, minw = 466, minh = 15 )
              self.AddButton ( self.btn, c4d.BFH_SCALEFIT, 120, 15, 'Okay' )
              return True
          
          def Command ( self, id, msg ) :
              if id == self.btn:
                  print 'object name'
              return True
        
      def main() :
          dialog = guiDialog ()
          dialog.Open ( dlgtype = c4d.DLG_TYPE_MODAL )
        
      if __name__=='__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 11/12/2014 at 01:52, xxxxxxxx wrote:

        Hello,

        to get the link of a linkbox simply call the GetLink()[URL-REMOVED] function of your linkbox. AddCustomGui()[URL-REMOVED] will return this linkbox. Either store the returned object or get it using FindCustomGui()[URL-REMOVED].

          
                 linkbox = self.FindCustomGui(id=4000,pluginid = c4d.CUSTOMGUI_LINKBOX)  
                   
                  if linkbox is not None:  
                      linkedObject = linkbox.GetLink(documents.GetActiveDocument())  
                        
                      if linkedObject is not None:  
                          print linkedObject  
        

        Best wishes,
        Sebastian


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 11/12/2014 at 10:14, xxxxxxxx wrote:

          Ah, FindCustomGui(). That's what I was looking for!

          Thank you!

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