GeDialog commands (source them out)

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

On 15/07/2008 at 01:32, xxxxxxxx wrote:

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

---------
   Hi!

I have a problem with the GeDialog. Can I source out some commands?

For example

> `

  
\>  class myGUI : public GeDialog  
\>  {  
\>    
\>  public:  
\>    
\>      void createLayout()  
\>      {  
\>          create_my_own_gui();  
\>      }  
\>    
\>  }  
\>    
\>    
\>    
\>  void create_my_own_gui()  
\>  {  
\>  AddStaticText(....);  
\>  }  
\>  

`

In this case, my compiler reports "Cannot use AddStaticText without an object."

What can I do? Thanks 🙂

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

On 15/07/2008 at 02:11, xxxxxxxx wrote:

AddStaticText() is a memberfunction of the class GeDialog, so your new function create_my_own_gui() should be a member of your derived class myGUI.

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

On 15/07/2008 at 02:12, xxxxxxxx wrote:

Hi! 🙂

Yes, you're right, the problem is, I have to source the memberfunctions out of the hole class... 😕

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

On 15/07/2008 at 02:26, xxxxxxxx wrote:

You could try declaring create_my_own_gui() as a friend in your class myGUI, then it should have access to its members, not sure if it will work though:

class myGUI : public GeDialog
{

public:
    
    friend void create_my_own_gui();

void createLayout()
    {
        create_my_own_gui();
    }
}

void create_my_own_gui()
{
AddStaticText(....);
}

If it doesnt work, try something like:
(function still declared as a friend)
void create_my_own_gui()
{
myGUI test;
test.AddStaticText(....);
}

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

On 15/07/2008 at 02:41, xxxxxxxx wrote:

Ah! Thats a good idea. I will give it a try.. Thanks 🙂

I give feedback on success..

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

On 15/07/2008 at 03:29, xxxxxxxx wrote:

Hi! 🙂

Now it works. I use this way:

void create_my_own_gui(myGUI *t)
{
if(!t) return;

t->AddStaticText(....);
}

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

On 15/07/2008 at 10:44, xxxxxxxx wrote:

CreateLayout() is a virtual/overloadable method of the GeDialog class, so don't bother with using your own name, just overload the original function...

    
    
      
    class myGUI : public GeDialog  
    {  
    public:  
        virtual Bool CreateLayout(void);  
    }  
      
    Bool myGUI::CreateLayout(void)  
    {  
        AddStaticText(....);  
        ...etc...  
        return true;  
    }  
    

...if you look in the SDK docs for the GeDialog class (as well as numerous others), you'll see several methods with 'virtual' tacked in front, sometimes with the comment:  "//Functions to override" ...you can override any of those that you need to when you derive from that class.