Issue when opening a ASYNC sub-dialog [SOLVED]



  • 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



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

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



  • 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.



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

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



  • 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?



  • 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:

      
     **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 element of the type CUSTOMGUI_LINKBOX. But you have to use a async dialog when you want to drag something into this link.

    best wishes,
    Sebastian



  • 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



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

    Hello,

    you could send a custom core message using SpecialEventAdd. Then you can listen for this message with GeDialog.CoreMessage.

    best wishes,
    Sebastian



  • 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.



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

    The SpecialEventAdd worked! Thanks Sebastian!


Log in to reply