Notifications
Clear all

[Closed] Max 2019 Struct bug

 MZ1

I think this is a struct bug in Max 2019, event handler doesn’t work if I instantiate the struct:


try(destroydialog TestRol)catch()
rollout TestRol "Test" width:100 height:100
(
   dotNetControl FLP_Test "flowLayoutPanel" width:100 height:100 pos:[0,0]
   
   on TestRol open do
   (
      b = dotnetobject "System.Windows.Forms.Button"
      b.width = b.height = 50
      b.text = "Button"
      fn onClick Sender Arg = 
      (
         print "Button Clicked."
      )
      dotnet.addEventHandler b "Click" onClick
      dotNet.setLifetimeControl b #dotnet
      FLP_Test.controls.add b
   )
)
struct MyStruct
(
   fn MyCreateDialog Rol = createdialog Rol
)
MyStruct  = MyStruct()
MyStruct.MyCreatedialog TestRol

2 Replies

Maybe it has to do with the new needed global scope for event handlers.
See this thread: http://forums.cgsociety.org/showthread.php?f=98&t=1503353&highlight=event+handler

1 Reply
 MZ1
(@mz1)
Joined: 2 years ago

Posts: 0

Fortunately it was solved in 2019.1.1.