Dotnetcontrol .focus isn't working.

Not sure why this isn't working. Maxscript help says there is a .focus property that you can set but when I try and set to it I get and error that the property doesn't exist. :/

All I want is for the textbox to lose focus when you hit enter.

Any help would be greatly appreciated.

	global Bigley_Dialog
	rollout rloutRTTSet "Rollout"
	(
		label spacer "" pos:[0,20]
		dotNetControl textb "TextBox" pos:[10,8] width:172 height:10
		on rloutRTTSet open do
		(
			textb.text = "Some text..."
		)
 
		on textb KeyUp e do
		( -- File Path Box
			if e.KeyCode == e.KeyCode.Enter do
			(
				textb.focus = false
			)
		)
	)
 
	Bigley_Dialog = newrolloutfloater "Dialog" 232 100
	addrollout rloutRTTSet Bigley_Dialog

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
teresa's picture

Such an interesting post in

Such an interesting post in terms of programming languages. I'm familiar in terms of programs and as I reviewed your code, it seems right but as you said, it's not working. Maybe there's something wrong with your software installations.-audio mastering free

Thank you for your informative post!

audio mastering tampa

Teresa Bowen

jeremiah_bigley's picture

Got it!

Nice man! Thanks for that!

I ended up using setfocus to just set the focus to another ui element. Originally didn't think it would work on non dotnet controls.

Much appreciated.

Anubis's picture

Hi Jeremiah

"Maxscript help says there is a .focus property"
- Where did you find this in mxs help?...

Max UI controlls has Not such property. The .NET controlls has .Focus() but it's a Method, not Property, and can be used only to set focus (ctrl_name.Focus()).

Never mind, Branko post a nice link, but I bother if you'll like to use .NET Forms instead of Max Rollouts, as suggested in that thread.

"All I want is for the textbox to lose focus when you hit enter."
- Try this one then:

global Bigley_Dialog, rloutRTTSet
rollout rloutRTTSet "Rollout"
(
	label spacer "" pos:[0,20]
	dotNetControl textb "TextBox" pos:[10,8] width:172 height:10
	button btnHidden pos:[0,100] visible:OFF
 
	on rloutRTTSet open do
	(
		textb.text = "Some text..."
	)
 
	on textb KeyUp e do
	( -- File Path Box
		if e.KeyCode == e.KeyCode.Enter do
		(
			setFocus btnHidden
		)
	)
)
if rloutRTTSet.isDisplayed do closeRolloutFloater Bigley_Dialog
Bigley_Dialog = newRolloutFloater "Dialog" 232 100
addRollout rloutRTTSet Bigley_Dialog

I think that you'll get the cheat idea here ;-)

my recent MAXScripts RSS (archive here)

jeremiah_bigley's picture

lol should have refreshed the

lol should have refreshed the page! Even better Anubis!

Really appreciate that! :D

Anubis's picture

no prob ;)

Btw, going by memory and I miss something :) using visible:OFF for btnHidden was bad idea. Just "hide" that button by set it pos out of the dialog, for example:
button btnHidden pos:[0,-30]

P.S. - .NET controlls are alot more cusomisable but if you not plan something else with .NET TextBox, then you can achieve the same effect with Max EditText control:

edittext etxt text:"Some text..." width:140
on etxt entered txt do (setFocus btnHidden)

my recent MAXScripts RSS (archive here)

barigazy's picture

Yep. Panayot is right. It's

Yep. Panayot is right. It's better to use standard mxs TextBox with mxs Rollout for your example. If you want to do something more complex then .net textbox or richTextBox is good solution.
This script is one of example http://www.scriptspot.com/3ds-max/scripts/mono-text-edit.
Also in attachment you can see example for Only Numerical Input (u can use TB as spinner)

AttachmentSize
numeric_textbox_input.ms 13.22 KB

bga

barigazy's picture

Look at this thread maybe you

Look at this thread maybe you can find the answer for your question.
http://forums.cgsociety.org/showthread.php?f=98&t=1070669

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.