I have a question about Dotnet form focus


#1

(
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

tForm.showmodeless()
InputBox2.Focus()
)

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?