Dotnet steal focus


#1

Hi

I’ found something strange in Dotnet form.
When I’m pressing a button to use a simple tool, then I can’t use it.
Only when I’m switch max window out and back, then is start work normally… :banghead:

I’m tried the same script for both interfaces , Max and Dotnet.
Here is examples.

–Max works


rollout focusTestDialog "Max Focus Test" width:196 height:124
(
	button btn1 "create point" pos:[80,44] width:88 height:32
	on btn1 pressed  do
	(
		tool create (on mousePoint click do point pos:gridPoint wirecolor:green) 
		startTool create
	)
)
createDialog focusTestDialog

–Dotnet failed


--DotNet Interface
(
	local form = dotNetObject "MaxCustomControls.Maxform"
	local btn   = dotNetObject "button"
	form.Text  = "Dotnet Focus Test"
	btn.text    = "create point"
	form.bounds = dotnetObject "Drawing.Rectangle" 200 400 196 124
	fn onMouseUp s a = 
	(
		tool create (on mousePoint click do point pos:gridPoint wirecolor:green) 
		startTool create
	)
	dotNet.addEventHandler btn "MouseUp" onMouseUp
	form.controls.add btn
	form.showModeless()
)

It is only on my Pc , or you get the same result?
I’m using 3DsMax 2012


#2

I’ve run into this I think. I was trying to use a mousetool via C# UI, and it wouldn’t start unless I first did something like, max Move, then called the script I believe.

This way it gave focus back to the max window, and worked.

Give that a shot?


#3

It works :thumbsup:
Greate! you are good! Thanks Man :beer:


#4

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.