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

    Issue when opening a ASYNC sub-dialog [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    10 Posts 0 Posters 782 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 20/10/2014 at 13:11, xxxxxxxx wrote:

      I have a ASYNC dialog. I want to be able to have a button open another ASYNC dialog as a sub dialog. Whenever I do, it makes the second one un-functional. Any button presses don't work.

      Anyone else seen this issue?

      Also, I would make it MODAL dialog. But it has to have a link box to drag an object to.

      Thanks,
      Joe

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

        On 20/10/2014 at 16:26, xxxxxxxx wrote:

        Do you keep a reference to the dialog after opening it?

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

          On 20/10/2014 at 20:05, xxxxxxxx wrote:

          No. I just want it to perform a task, then close. It just needs to be ASYNC.

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

            On 20/10/2014 at 22:18, xxxxxxxx wrote:

            Well, you need to keep a reference, otherwise its being garbage collected

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

              On 21/10/2014 at 06:18, xxxxxxxx wrote:

              Hmm.. Sample code would be a lot more helpful..

              Not too sure how to do this?

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

                On 21/10/2014 at 09:47, xxxxxxxx wrote:

                Hello,

                simply add a member variable to the first dialog. This way the second dialog is owned and managed by the first GeDialog[URL-REMOVED]:

                  
                 **class DialogB(c4d.gui.GeDialog) :**  
                  
                  def CreateLayout(self) :  
                      self.SetTitle("Dialog B")  
                      self.AddCustomGui(id=1001, pluginid=c4d.CUSTOMGUI_LINKBOX, name="Link", flags=c4d.BFH_LEFT, minw=200, minh=100)  
                      self.AddButton(id=1000,flags=c4d.BFH_LEFT,initw=100,inith=100,name="Close")  
                        
                      return True  
                        
                  def Command(self, id, msg) :  
                    
                      if id == 1000:  
                          self.Close()  
                  
                      return True  
                        
                  
                **class DialogA(c4d.gui.GeDialog) :**  
                  
                  dialog = None  
                  
                  def CreateLayout(self) :  
                      self.SetTitle("Dialog A")  
                      self.AddButton(1000,c4d.BFH_LEFT,200,100,"Open Dialog")  
                      return True  
                        
                  def Command(self, id, msg) :  
                    
                      if id == 1000:  
                          if self.dialog == None:  
                              self.dialog = DialogB()      
                          self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=1000051, defaultw=400, defaulth=400)      
                    
                      return True  
                  
                

                To use a link in a dialog you have to create a custom GUI[URL-REMOVED] element of the type CUSTOMGUI_LINKBOX[URL-REMOVED]. But you have to use a async dialog when you want to drag something into this link.

                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 21/10/2014 at 11:56, xxxxxxxx wrote:

                  Got it! I placed the dialog reference before the code. But I can change it to what you posted. Also, I want the main dialog (DialogA) to do something once DialogB closes. Any ideas with that?

                  On a MODAL dialog, it waits. But with an ASYNC, it just runs through the rest of the code after DialogB opens..

                  Thanks,
                  Joe

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

                    On 22/10/2014 at 02:37, xxxxxxxx wrote:

                    Hello,

                    you could send a custom core message using SpecialEventAdd[URL-REMOVED]. Then you can listen for this message with GeDialog.CoreMessage[URL-REMOVED].

                    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 22/10/2014 at 03:23, xxxxxxxx wrote:

                      Originally posted by xxxxxxxx

                      On a MODAL dialog, it waits. But with an ASYNC, it just runs through the rest of the code after DialogB opens..

                      That's pretty much the idea behind asynchronous dialogs. They run in a different thread, not blocking
                      the execution from which you open it.

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

                        On 22/10/2014 at 06:20, xxxxxxxx wrote:

                        The SpecialEventAdd worked! Thanks Sebastian!

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