Notifications
Clear all

[Closed] DotNet eventhandler broke after file reset

Hi,

I’ve discovered a problem with any eventhandler on a dotNetObject added via dotNet.addEventHandler Mybutton “click” MyAction
which usually works fine but after I do a reset file in max the DotNetEventHandler doesn’t call MyAction() any more.

The only solution I found so far is to restart the dialog and reinitialising all event handlers…

Is there a way to prevent this?

Thanks,
Stefan

4 Replies

Did you try if your event handlers also break when performing a garbage collection, gc()?
They have to be stored into a global variable.

lookup DotNet Objects and Classes Life Time Control in the mxs reference. you need to set the event lifetime to #dotnet

Ah yes that’s better than setting it global. Forgot about that one.

Thanks Gravey,

the dotNet.setLifeTimeControl was the solution i searched for!

Regards,
Stefan