I have a question about Dotnet form focus


tform=dotNetObject “MaxCustomControls.MaxForm”
InputBox2=dotNetObject “System.windows.forms.TextBox”

Btn2 = dotNetObject “System.windows.forms.button”
Btn2.Location=dotnetobject “System.Drawing.Point” 100 100

fn do_nothing=(InputBox2.focus())

tForm.controls.add InputBox2
tForm.controls.add Btn2
dotnet.addEventHandler Btn2 “Click” do_nothing


My code looks like this

in this situation, if the user moves out of tForm to another window ( Like Max’s Viewport)
I will run this
“function close_form= tForm.close()”

What should I do?


this is usually handled by an event, there should be an event called LostFocus

you can find all the events in maxscript manual

this will probably look like
on tForm lostfocus e do tForm.close()