Creating a preference dialog?

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

On 27/03/2004 at 08:35, xxxxxxxx wrote:

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

---------
Hi,

Im trying to create a preferences dialog but im not sure what I need to do.

I created the basic classes to represent a preference dialog

  
class MyPrefsDialog: public PrefsDlg_Base  
{  
public:  
     MyPrefsDialog(PrefsDialogHookClass *hook) : PrefsDlg_Base(ID_PLUGIN,hook) { }  
  
};  
  
  
class MyPrefs: public PrefsDialogHookClass  
{  
public:  
     virtual SubDialog *Alloc() { return gNew MyPrefsDialog(this); }  
     virtual void Free(SubDialog *dlg) { gDelete(dlg); }  
  
};  

But I don't know how to actually initialize it, this is what I thought it would be

  
MyPrefs prefs;  
MyPrefsDialog *dlg=static_cast<MyPrefsDialog*>(prefs.Alloc());  
prefs.Register(ID_PLUGIN,"Testing");  

But this crashes cinema when clicking on preferences under the edit menu.

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

On 29/03/2004 at 05:13, xxxxxxxx wrote:

hi geespot,

to start your plug-in use this code:

  
MyPrefs mp;  
SubDialog *sd;  
Bool PluginStart(void)  
{  
     if (!mp.Register(ID_PLUGIN,"Testing")) return FALSE;  
     if (!sd) sd = mp.Alloc();     // create a new element in preferences dialog  
  
     return TRUE;  
}  
  
void PluginEnd(void)  
{  
     if (sd) mp.Free(sd);  
}  

that's what's suggested by c++ documentation and it won't crash.

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

On 29/03/2004 at 14:50, xxxxxxxx wrote:

Thanks!
your a star 🙂