Notifications
Clear all
[Closed] WPF eventhandler not working
Dec 01, 2018 6:28 pm
This script works very well in Max 2019, But in older version button’s event handler doesn’t work. Any idea what is changed in 2019 which is not available in older versions?
delete objects
clearlistener()
dotNet.loadAssembly "WindowsFormsIntegration.dll"
CustAtt = attributes Tracks
(
parameters Param_Main rollout:Rol_Main
(
)
rollout Rol_Main "Parameters"
(
dotNetControl ElementHost "Integration.ElementHost" width:Rol_Main.width height:200 pos:[0,0]
on Rol_Main open do
(
TheButton = dotnetobject "system.windows.controls.button"
fn OnClick Sender Arg =
(
print "Clicked"
)
dotnet.addeventhandler TheButton "Click" OnClick
dotNet.setLifetimeControl TheButton #dotnet
ElementHost.child = TheButton
)
)
)
Obj = teapot isselected:true
AttMd = EmptyModifier name:"Custom"
addmodifier Obj AttMd
custAttributes.add AttMd CustAtt