SOLVED gNew deprecated, ok, but NewObj generates compiler error

Hi, I am working my way up from C4D R16, yes, I have all C4D Studio versions R13-R23, but I really want this to work.
SDK = C4D R16
Here is the code:

/////// The customGUI's data class ///////////////
class SliderData : public CustomGuiData
{
    typedef CustomGuiData super;
    public:
    virtual Int32 GetId() { return LIBRAY_ID; }     //Gets the ID# we defined at the top for this gizmo
    virtual CDialog *Alloc(const BaseContainer &settings)
	{
        // Next line compiler complains
		GeDialog *dlg = gNew MyCustomGui(settings, GetPlugin());
		if (!dlg) return NULL;
        return dlg->Get();
    }

    virtual void Free(CDialog *dlg, void *ud)
	{
        if (dlg)
		{
            // Old does not work
			//gDelete((GeDialog*&) dlg);   //Free the memory used by allocating dlg
            
			//New - no complaints
			DeleteObj((GeDialog*&) dlg);	//Free the memory used by allocating dlg
        }
    }

So my question is - how can I rewrite the line containing gNew, so that it works again? (Works fine in R14).
I have tried with NewObj() and NewObjClear() - compiler still complains.
-Ingvar

You create a custom GUI to display your custom data by deriving a class from iCustomGUI

class iMyCustomGUI : public iCustomGui
...

Then in you CustomGUIData derived class you implement the allocation by providing the derived iCustomGUI

CDialog* ReferencePointCustomGUI::Alloc(const BaseContainer& settings)
{
    iMyCustomGUI* dlg = NewObjClear(iMyCustomGUI, settings, GetPlugin());
    ...

you can find more details in the R20 SDK example customdata_customgui.cpp in folder cinema4dsdk\source\gui
Works OK for R16 upto at least R21 (I have not used/tested in more recent versions)

You create a custom GUI to display your custom data by deriving a class from iCustomGUI

class iMyCustomGUI : public iCustomGui
...

Then in you CustomGUIData derived class you implement the allocation by providing the derived iCustomGUI

CDialog* ReferencePointCustomGUI::Alloc(const BaseContainer& settings)
{
    iMyCustomGUI* dlg = NewObjClear(iMyCustomGUI, settings, GetPlugin());
    ...

you can find more details in the R20 SDK example customdata_customgui.cpp in folder cinema4dsdk\source\gui
Works OK for R16 upto at least R21 (I have not used/tested in more recent versions)

Hi and thanks for this. It is my bad.. I didn't read the docs carefully enough / or did not understand the docs.
Now this works!
-Ingvar