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

    Dialog in Dialog

    SDK Help
    0
    26
    15.2k
    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
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 05/10/2011 at 09:41, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hey Guys,

      I try to create a Dialog (RenameDialog) in a Dialog (MainDialog).

      The first time open the RenameDialog works, but when I start the dialog a secound time, the dialog will not create his layout.

      Dialog.h

        
      #define ID_DIALOG 123456789  
        
      class RenameDialog : public GeDialog  
      {  
      private:  
        String name;  
      public:  
        virtual Bool CreateLayout(void);  
        virtual Bool InitValues(void);  
        virtual Bool Command(LONG id, const BaseContainer& msg);  
        
        Bool SetName(String name);  
        String GetName();  
      };  
        
      class MainDialog : public GeDialog  
      {  
      private:  
        RenameDialog dlg;  
      public:  
        virtual Bool CreateLayout(void);  
        virtual Bool InitValues(void);  
        virtual Bool CoreMessage(LONG id, const BaseContainer& msg);  
        virtual Bool Command(LONG id, const BaseContainer& msg);  
      };  
        
      class Dialog : public CommandData  
      {  
      private:  
        MainDialog dlg;  
      public:  
        virtual Bool Execute(BaseDocument *doc);  
        virtual Bool RestoreLayout(void *secret);  
      };  
      

      Dialog.cpp

        
      //Headers from c4d  
      #include "c4d.h"  
        
      //Headers from Plugin  
      #include "Dialog.h"  
        
      //////////////////////////////////////////////////////////////////////////////  
      //                                                                              
      //    RenameDialog - GeDialog  
      //                                                                              
      //////////////////////////////////////////////////////////////////////////////  
        
      // GeDialog.CreateLayout  
      //*---------------------------------------------------------------------------*  
      Bool RenameDialog::CreateLayout(void)  
      //*---------------------------------------------------------------------------*  
      {  
        AddEditText(500, BFH_LEFT, 150, 0);  
        
        AddButton(1000, BFH_LEFT, 0, 0, "OK");  
        AddButton(1001, BFH_LEFT, 0, 0, "Cancel");  
        
        return TRUE;  
      }  
        
      // GeDialog.InitValues  
      //*---------------------------------------------------------------------------*  
      Bool RenameDialog::InitValues(void)  
      //*---------------------------------------------------------------------------*  
      {  
        SetString(500, name);  
        return TRUE;  
      }  
        
      // GeDialog.Command  
      //*---------------------------------------------------------------------------*  
      Bool RenameDialog::Command(LONG id, const BaseContainer& msg)  
      //*---------------------------------------------------------------------------*  
      {  
        switch(id)  
        {  
            case 1000:  
                {  
                    GetString(500,name);  
                    SpecialEventAdd(101010101);  
                    Close();  
                }  
        
            case 1001:   
                {  
                    Close();  
                }  
        }  
              
        return TRUE;  
      }  
        
      //*---------------------------------------------------------------------------*  
      Bool RenameDialog::SetName(String name)  
      //*---------------------------------------------------------------------------*  
      {  
        this->name = name;  
        
        return TRUE;  
      }  
        
      //*---------------------------------------------------------------------------*  
      String RenameDialog::GetName()  
      //*---------------------------------------------------------------------------*  
      {  
        return name;  
      }  
        
      //////////////////////////////////////////////////////////////////////////////  
      //                                                                              
      //    MainDialog - GeDialog  
      //                                                                              
      //////////////////////////////////////////////////////////////////////////////  
        
      // GeDialog.CreateLayout  
      //*---------------------------------------------------------------------------*  
      Bool MainDialog::CreateLayout(void)  
      //*---------------------------------------------------------------------------*  
      {  
        SetTitle("Test");  
        AddButton(1000,0,0,0,"Start");  
        return TRUE;  
      }  
      //*---------------------------------------------------------------------------*  
        
      // GeDialog.CoreMessage  
      //*---------------------------------------------------------------------------*  
      Bool MainDialog::CoreMessage(LONG id, const BaseContainer& msg)  
      //*---------------------------------------------------------------------------*  
      {  
        GePrint(LongToString(id));  
        if(id==101010101)  
        {  
            GePrint(dlg.GetName());  
        }  
        
        return TRUE;  
      }  
        
      // GeDialog.Command  
      //*---------------------------------------------------------------------------*  
      Bool MainDialog::Command(LONG id, const BaseContainer& msg)  
      //*---------------------------------------------------------------------------*  
      {  
        if(id==1000)  
        {  
            dlg.SetName("test string");  
            dlg.Open(DLG_TYPE_MODAL,ID_DIALOG);  
        }  
        
        return TRUE;  
      }  
                                                                  
      //////////////////////////////////////////////////////////////////////////////  
      //  
      //    Dialog - CommandData  
      //                                                                              
      //////////////////////////////////////////////////////////////////////////////  
        
      // CommandData.Execute  
      //*---------------------------------------------------------------------------*  
      Bool Dialog::Execute(BaseDocument* doc)  
      //*---------------------------------------------------------------------------*  
      {      
        return dlg.Open(DLG_TYPE_MODAL,ID_DIALOG);  
      }  
        
      // CommandData.RestoreLayout  
      //*---------------------------------------------------------------------------*  
      Bool Dialog::RestoreLayout(void* secret)  
      //*---------------------------------------------------------------------------*  
      {  
        return dlg.RestoreLayout(ID_DIALOG,0,secret);  
      }  
        
      Bool RegisterDialog(void)  
      {  
        return RegisterCommandPlugin(ID_DIALOG,"Dialog",0,NULL,String(),gNew Dialog);  
      }  
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 05/10/2011 at 23:02, xxxxxxxx wrote:

        1. While it is possible to have the dialog as a live member it is better to make the member a pointer and allocate (and free) the dialog manually.  I've encountered some odd behavior using it the other way.

        2. Always call the base class CreateLayout() at the top of your CreateLayout() method using:
        GeDialog::CreateLayout();

        3. I've encountered some very strange behavior in R13 with respect to GeDialogs.  Foldable groups have been somewhat painful as they either won't unfold or, when being folded, disappear completely.  What you are experiencing might be a related glitch in the dialog system of R13.  If the problem continues and there is no explanation from support, I'd report it as a bug.

        Additional: It is good C++ (and OOP) behavior to always include a constructor and destructor even if you have nothing to allocate, initialize, or free.  Default constructors/destructors can exhibit unexpected behavior and it is better to override them so that you know the flow of your class instances precisely.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 06/10/2011 at 09:14, xxxxxxxx wrote:

          Thank you again Robert, for your detailed answer. I see you have a very skilful knowledge.

          Therer are some passages, which I don´t understand. But I solved my problem.

          To 1.:
          You mean

          RenameDialog* dlg;
          

          ? How to Allocate something like that?

          To 2.:
          Done. 🙂 But Why?

          To 3.:
          Strange. Maybe Matthias knows more?

          To Additional:
          Ok. Done.

          My new solution:

          Create local variable when button get pressed:

          RenameDialog dlg;  
                dlg.SetName("123");  
                dlg.Open(DLG_TYPE_MODAL,ID_DIALOG);
          

          And in the new dlg I use a SpecialEventAdd(id, 123, my_data);

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 06/10/2011 at 19:01, xxxxxxxx wrote:

            1. Yes.  In the class definition, use that.  In some method of that class (create an Init() method that you can call), you allocate the dialog:

            MainDialog::Init()
            {
            dlg = gNew RenameDialog;
            if (!dlg) return FALSE; // or similar
            return TRUE;
            }

            In your constructor, initialize the member variable to ensure that it has a valid value:

            MainDialog::MainDialog()
            {
            dlg = NULL;
            }

            You will also need to free the instance.  Do this in the destructor:

            MainDialog::~MainDialog()
            {
            gFree(dlg);
            }

            2.  No idea but I think this ensures that the base class method CreateLayout() is called so that the dialog is properly (fully?) prepared for the C4D GUI system.

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 07/10/2011 at 06:57, xxxxxxxx wrote:

              Works great, thank you. 🙂

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 12/03/2012 at 18:53, xxxxxxxx wrote:

                Sorry to bump this old thread.
                But can anyone provide me with a very simple working example of a dialog in a dialog that doesn't have the subdialog's class in a separate .h file?

                I've tried to use what's posted here. But I it's not enough information for me to figure it out.
                My subdialog always ends up empty with no gizmos in it.

                Thanks,
                -ScottA

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 13/03/2012 at 22:43, xxxxxxxx wrote:

                  Hi Scott,
                  [edit] Removed a link to one of my plugins, as I got the question wrong and the link won't contribute to this issue at all.
                  Sorry,
                  Andreas

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 13/03/2012 at 23:57, xxxxxxxx wrote:

                    Hi Andreas,
                    When I say a subdialog. I don't mean a "subdialog" in the way the SDK uses the word.
                    The SDK actually has a pretty good "subdialog" example in it.
                    What I'm talking about is making another completely different dialog open from inside of a dialog.
                    I don't see anything like that in your color plugin. But the way the colorpicker dialog window pops up is basically the result I'm trying to achieve.

                    I have some questions I can't find the answers to concerning this:
                    -Do I Need to use a separate ID number for my subdialog(popup dialog) to work?
                    -Do I need to register that second dialog?<-- It crashes when I try
                    -I can make the new dialog window open.. But how do I get the gizmos to show up in that dialog?

                    Here's a very simple plugin example that only has one button in the main dailog.
                    When the button is clicked. It opens the subdialog(second dialog) whatever we're supposed to call it.:

                    // be sure to use a unique ID obtained from www.plugincafe.com  
                    #define PLUGIN_ID 1000006  
                    #define SUB_PLUGIN_ID 1000007  
                      
                    #include "c4d.h"  
                    #include "gui.h"  
                    #include "c4d_symbols.h"  
                      
                    class SubDialog1 : public GeDialog  
                    {  
                    public:  
                      virtual Bool CreateLayout(void);  
                      virtual Bool InitValues(void);  
                      virtual Bool Command(LONG id, const BaseContainer& msg);  
                    };  
                      
                    Bool SubDialog1::CreateLayout(void)  
                    {  
                      AddEditText(500, BFH_LEFT, 150, 0);  
                      
                      AddButton(1000, BFH_LEFT, 0, 0, "OK");  
                      AddButton(1001, BFH_LEFT, 0, 0, "Cancel");  
                      
                      return TRUE;  
                    }  
                      
                    Bool SubDialog1::InitValues(void)  
                    {  
                      return TRUE;  
                    }  
                      
                    Bool SubDialog1::Command(LONG id, const BaseContainer& msg)  
                    {          
                      return TRUE;  
                    }  
                      
                      
                    class myDialog : public GeDialog  
                    {  
                      private:  
                          SubDialog1 *dlg;          
                          LONG rows;  
                      
                      public:  
                      
                          myDialog(void);  
                          virtual Bool CreateLayout(void);  
                          virtual Bool InitValues(void);  
                          virtual Bool Command(LONG id,const BaseContainer &msg);  
                          virtual LONG Message(const BaseContainer &msg,BaseContainer &result);  
                          virtual Bool CoreMessage  (LONG id,const BaseContainer &msg);  
                    };  
                      
                      
                      
                    myDialog::myDialog(void)  
                    {  
                      rows = 1;  
                      dlg = NULL;  
                    }  
                      
                      
                    Bool myDialog::CreateLayout(void)  
                    {  
                      SetTitle("Simple C++ Gui");  
                      AddButton(1002, BFH_LEFT, 0, 0, "Launch Subdialog");  
                        
                      return TRUE;  
                    }  
                      
                      
                    Bool myDialog::InitValues(void)  
                    {  
                      // first call the parent instance  
                      if (!GeDialog::InitValues()) return FALSE;  
                        
                      return TRUE;  
                    }  
                      
                    Bool myDialog::Command(LONG id,const BaseContainer &msg)  
                    {  
                      if(1002)   //If the button is pressed..open the subdialog  
                      {  
                          SubDialog dlg;  
                          dlg.Open(DLG_TYPE_MODAL_RESIZEABLE, SUB_PLUGIN_ID);  
                      }  
                      
                      return TRUE;  
                    }  
                      
                      
                      
                    Bool myDialog::CoreMessage(LONG id,const BaseContainer &msg)  
                    {  
                      return GeDialog::CoreMessage(id,msg);  
                    }  
                      
                    LONG myDialog::Message(const BaseContainer &msg,BaseContainer &result)  
                    {  
                      
                      return GeDialog::Message(msg,result);  
                    }  
                      
                    class mySimpleDialog : public CommandData // mySimpleDialog is the class name that needs to be listed in the main.cpp to register it properly   
                    {  
                      private:  
                          myDialog dlg;  
                      
                      public:  
                          virtual Bool Execute(BaseDocument *doc);  
                          virtual LONG GetState(BaseDocument *doc);  
                          virtual Bool RestoreLayout(void *secret);          
                    };  
                      
                    LONG mySimpleDialog::GetState(BaseDocument *doc)  
                    {  
                      return CMD_ENABLED;  
                    }  
                      
                    Bool mySimpleDialog::Execute(BaseDocument *doc)  
                    {  
                      //return dlg.Open(DLG_TYPE_ASYNC_FULLSCREEN_MONITOR,ID_PLUGIN,0,0); // use for full screen if desired  
                      return dlg.Open(DLG_TYPE_ASYNC,PLUGIN_ID, -1, -1, 300,150);  
                    }  
                      
                    Bool mySimpleDialog::RestoreLayout(void *secret)  
                    {  
                      return dlg.RestoreLayout(PLUGIN_ID,0,secret);  
                    }  
                      
                    Bool RegistermySimpleDialog(void)  
                    {  
                      return RegisterCommandPlugin(PLUGIN_ID,GeLoadString(IDS_mySimpleDialog),0,AutoBitmap("icon.tif"),String("My Simple Dialog"),gNew mySimpleDialog);      
                    }
                    

                    This will open a new dialog window from my main dialog.
                    But it's empty. My text and two buttons don't show up.
                    I'm missing something important(probably several things).

                    -ScottA

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 14/03/2012 at 00:22, xxxxxxxx wrote:

                      Scott,
                      sorry, I misunderstood.
                      Looking at your code, I'm wondering, if it is a good idea to instantiate your subdialog on stack inside of the command function. I guess, you'd rather have to create your subdialog instance in myDialog constructor (where you set dlg pointer to NULL) and call dlg->Open() instead of dlg.Open() in myDialog::Comand(). Just like you're doing it in your main dialog.
                      Regards,
                      Andreas

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 14/03/2012 at 08:01, xxxxxxxx wrote:

                        Yeah. That sounds similar to Robert's Init() method recommendation.
                        But I just can't get it to work. It crashes on me.

                        Here's an example:

                        class myDialog : public GeDialog  
                        {  
                          private:  
                              SubDialog1 *dlg;          
                              LONG rows;  
                          
                          public:  
                          
                              myDialog(void);  
                              Bool Init();  
                              virtual Bool CreateLayout(void);  
                              virtual Bool InitValues(void);  
                              virtual Bool Command(LONG id,const BaseContainer &msg);  
                              virtual LONG Message(const BaseContainer &msg,BaseContainer &result);  
                              virtual Bool CoreMessage  (LONG id,const BaseContainer &msg);  
                        };  
                          
                        myDialog::myDialog(void)  
                        {  
                          rows = 1;  
                          dlg = NULL;   
                        }  
                          
                        Bool myDialog::Init()  
                        {  
                          dlg = gNew SubDialog1;  
                          if (!dlg) return FALSE;   
                          return TRUE;  
                        }  
                          
                        ///////////////  My Command method ///////////  
                        Bool myDialog::Command(LONG id,const BaseContainer &msg)  
                        {  
                          if(1002)   //If the button is pressed..open the subdialog  
                          {  
                              dlg->Open(DLG_TYPE_MODAL_RESIZEABLE, SUB_PLUGIN_ID);  
                          }  
                          return TRUE;  
                        }  
                          
                        }
                        

                        I don't know what I'm doing wrong.
                        But boy.. it crashes very badly.

                        -ScottA

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 14/03/2012 at 12:31, xxxxxxxx wrote:

                          Hi Scott,
                          I think I found the culprit.
                          Please try one of the following:

                          1. Don't use a SubDialog1 pointer, but rather make a member an instance od SubDialog1, by changing:
                          SubDialog1 *dlg;
                          

                          into

                          SubDialog1 dlg;
                          

                          Then of course you need to use . instead of -> in Command().
                          This has the advantage, that you don't need to care to free the dialog, which you need to pay attention to in 2).
                          2) Don't create your SubDialog1 in Init() but rather in the constructor, like so:

                            
                          myDialog::myDialog(void)  
                          {  
                            rows = 1;  
                            dlg = gNew SubDialog1;  
                            if (!dlg) return; // Note not sure, what to do here, if it fails...  
                          }  
                          

                          At least this does the trick here (although I have to admit, I did use DLG_TYPE_ASYNC for testing). Not sure if it's a good idea to open a modal dialog from Command()...
                          And to be honest, I also don't understand, why your method does not work from Init(), but I remember having trouble with Init() as well in another context. Perhaps Matthias or Yannick can give us some inside view on Init()?
                          [edit] Just did another test, and I really don't get it, why Init() does not work. It seems to be called right after the constructor (as we expected). I fear, I'm missing something big in here as well...

                          Hope it works for you as well,
                          Andreas

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

                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                            On 14/03/2012 at 13:20, xxxxxxxx wrote:

                            Thanks a ton! Works like a charm.🍺
                            This stupid thing was driving me absolutely crazy.

                            I read in another post a comment that using a modal dialog we don't have to use a second pluginID. But I'm not sure if that applies to what we're doing here or not. I can't seem to get it to work if I call the second dialog with same pluginID.

                            It would be nice to know more about this. And maybe Robert will pop in here at some point and offer more info about how to use an Init() function.
                            But even if he doesn't. I'm happy enough with the way I've got it set up and working now with your help.

                            Cheers,
                            -ScottA

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

                              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                              On 14/03/2012 at 13:58, xxxxxxxx wrote:

                              Doh!
                              Foiled again.

                              After testing it some more. This isn't going to work.
                              The dialog pops up when a gizmo is used in the main dialog.😠
                              I'm pretty sure this is why Robert was talking about using an Init() function.

                              Still looking for a solution.

                              -ScottA

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

                                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                On 14/03/2012 at 14:24, xxxxxxxx wrote:

                                You mean it pops up, even if the open function is not called?
                                I'll try to reproduce it tomorrow.

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

                                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                  On 14/03/2012 at 14:28, xxxxxxxx wrote:

                                  Yeah.
                                  Any gizmo activity in the Command() method of the main dialog makes it open. Which is very bad.

                                  -ScottA

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

                                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                    On 14/03/2012 at 14:51, xxxxxxxx wrote:

                                    First, you should never allocate memory in a constructor as the behavior is unpredictable (there is no return path for failure).  myDialog->Init() must be called after the creation of your dialog in order to ensure that the subdialog is created for later use.

                                    Second, you should check that the SubDialog was created even in later calls (in Command(), for instance) :

                                        
                                        
                                        ///////////////  My Command method ///////////  
                                        Bool myDialog::Command(LONG id,const BaseContainer &msg)  
                                        {  
                                          if(1002)   //If the button is pressed..open the subdialog  
                                          {  
                                              if (dlg && !dlg->IsOpen()) dlg->Open(DLG_TYPE_MODAL_RESIZEABLE, SUB_PLUGIN_ID);  
                                          }  
                                          return TRUE;  
                                        }  
                                          
                                        }
                                    

                                    Third, SubDialogs must be attached to the dialog (GeDialog) using AttachSubDialog() if you are adding it as a control element of the dialog (AddSubDialog()).

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

                                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                      On 14/03/2012 at 16:10, xxxxxxxx wrote:

                                      Hi Robert,
                                      Thanks for popping in. But I'm afraid you've lost me.

                                      I don't know where you're expecting me to call the Init() method. Or how.
                                      I don't understand what you're talking about with AttachSubDialog(). This is not a subdialog. It's a dialog within a dialog.
                                      Are you saying that I need to use the same kind of code for this as they use to create subdialogs?

                                      I don't think I'm going to be able follow all the things you're talking about without looking at a simple working example. And studying how everything works.
                                      Just a very simple example of a dialog with a button in it that opens another dialog that has maybe just a textbox and a close button in it. That's it.

                                      What can I do to make this example happen?
                                      Can I send you something? My plugin code?
                                      These little hints you're dropping just aren't enough for me to figure it out. They just leave me confused with more questions.

                                      -ScottA

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

                                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                        On 14/03/2012 at 18:12, xxxxxxxx wrote:

                                        If you create the GeDialog using gNew then call Init() after that:

                                        myDialog* mydlg; // As a member of some class

                                        mydlg = gNew myDialog;
                                        if (!mydlg) return FALSE;
                                        if (!mydlg->Init()) return FALSE; // subdialog failed to allocate

                                        If you declare your myDialog as an instance of another class then you should call the Init() at some initialization of that other class.  Hard to say without seeing code.  If there is no other class then you will need to initialize it in your main.cpp.

                                        A BIG note about dialogs: You really don't need to use SubDialog for opening new dialogs from a dialog (synchronous or not).  SubDialogs are for attaching a bunch of GUI elements directly to the GUI of a GeDialog.  You can open new dialogs from a GeDialog as GeDialogs (and, yes, that means you can open a dialog from a dialog opened from another dialog ad infinitum).  Maybe that is where your problem lies : you are trying to treat a SubDialog which needs to show up inside your Dialog as a new separate Dialog.  That is not the purpose of a SubDialog.  Use GeDialog instead.

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

                                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                          On 14/03/2012 at 19:57, xxxxxxxx wrote:

                                          Thanks Robert,
                                          But I'm afraid I don't have enough knowledge to apply what you're saying.

                                          I understand most of it in theory.
                                          But I have too many "what goes where" questions about creating the framework for the classes and methods.
                                          Without a working example to learn from. I'm not going to be able to figure this one out just from hints & tips.

                                          Thanks for the help,
                                          -ScottA

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

                                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                            On 14/03/2012 at 23:11, xxxxxxxx wrote:

                                            Hi,
                                            of course Robert is right about allocation in a constructor (and about testing for NULL pointer in Command()). So at first forget my 2) version and rather stick with the 1). Then I'm not sure, if Robert realized, that your SubDialog1 is no subdialog, but rather a normal GeDialog (which confused me in my first post as well). At least that's what his explanations about AttachSubdialog() suggest.
                                            I get confused about the manual Init() call, Robert talks about. I thought this was implicitly done for classes derived from e.g. GeDialog. But if it's not, this might be one of our problems with Init(), but I doubt that this is a problem with your SubDialog1 opening on any "Command()" interaction.
                                            I'll do some testing this evening and try to see, if I can get it to work.

                                            Another slightly off topic question:
                                            I'm thinking about a GoogleCode (or SourceForge or what not) project, where we could share such examples and could actively work on such problems together. This would make it easier to understand some problems (as there would be the complete source for a problem) and several people could actively add in or optimize. A bit like the SDK examples... I have s slight feeling, that SVN (or CVS or GIT) usage () is not so common or popular in this community, but I'd happily stand aside to get everyone going. And don't fear, I'm not suggesting to open up your plugin development. Just these small code snippets we're discussing here, could be administered and collected in one common place in a somewhat enhanced manner.
                                            I certainly don't want to counter spedler's great work of examples on Microbion's site, but perhaps he would like to contribute to such a project, too.
                                            I'd also ask this question more prominently in a separate thread, but for now, I'd be interested in your opinions first.

                                            If there's some positive feedback, I'd set up such a project and would add this issue here as a starting point.
                                            Regards,
                                            Andreas

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