Is dialog alive?

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

On 16/11/2008 at 08:13, xxxxxxxx wrote:

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

---------
Hi!

The class BaseBitmapLink and BaseLink returns NULL if the object is not alive when deleted. I have a hook in ToolData which returns a SubDialog in 'AllocSubDialog' where Cinema 4D takes the ownership.

Is a class avaible which returns NULL if the Dialog was deleted?

Cheers,

Shawni

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

On 17/11/2008 at 14:12, xxxxxxxx wrote:

Hi! problemo solved 🙂

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

On 18/11/2008 at 02:09, xxxxxxxx wrote:

Do you mind to share how you solved the problem?

cheers,
Matthias

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

On 18/11/2008 at 03:25, xxxxxxxx wrote:

Hi! 🙂

Sure, I wanted to write, but I forgot in hectic. I wrote my own class like BaseLink, BaseBitmapLink.

> \>      class DialogClassLink \>      { \>           private: \>                void \*obj; \>           public: \>                DialogClassLink(); \>                void \*Get(); \>                void Set(void \*bmp); \>      }; \> \>           DialogClassLink::DialogClassLink() \>           { \>                obj = NULL; \>           } \> \>           void\* DialogClassLink::Get() \>           { \>              return obj; \>           } \> \>           void DialogClassLink::Set(void \*bmp) \>           { \>              obj = bmp; \>           } \> \>

So this is my class which should return NULL if the dialog is not alive.

> \> \> class csDialogClass : public SubDialog \> { \>      private: \>           GeAutoDynamicArray<DialogClassLink\*>lnk; \>       \>      public: \>           ~csDialogClass(); \>           void PushClassLink(DialogClassLink\* obj); //this method is called if this dialog was passed to an object of DialogClassLink \> } \> \> void csDialogClass::PushClassLink(DialogClassLink\* obj) \> { \>      lnk.Push(obj); \> } \> \> csDialogClass::~csDialogClass() \> { \>      for(LONG i=0;i<lnk.count;i++) \>           lnk[i]->Set(NULL); \> } \>

For example:

> \> csDialogClassLink\* my_diag = gNew csDialogClassLink; \> \> DialogClassLink \* lnk = gNew DialogClassLink; \> lnk->SetLink(my_diag); \> my_diag.PushClassLink(lnk); \> \> gDelete(my_diag); \> \> csDialogClassLink\* is_alive = (csDialogClassLink\* )lnk->Get();   //returns NULL because deconstructor sets 'lnk' member to NULL. \> \>

The dialog sets all members of DialogClassLinks to NULL which are connected to 'this'. I don't know if its the best way, but for me it works. If you hae any questions, critics or comments, please let me know.

Cheers, Seb.