Share

Setting Focus on User Interface Controls

You can set the focus on a specific User Interface Control Item, RolloutFloater or Rollout using

setFocus (<RolloutControl>|<RolloutFloater>|<Rollout>|<Rollout>.hwnd)

You can bring to the front (ie, make the "top" dialog) and set the focus on a User Interface Control item, RolloutFloater, or Rollout using Available in 3ds Max 2021.1 Update and higher.

setForegroundWindow (<RolloutControl>|<RolloutFloater>|<Rollout>|<Rollout>.hwnd)

EXAMPLE:

rollout testFocus "Test Focus"
(
  edittext text1 "Test"
  edittext text2 "Focus"
)
createDialog testFocus 200 100
testFloater = newRolloutFloater "My Floater" 300 220

setfocus testFocus
setfocus testFocus.hwnd
setfocus testFocus.text2 -- the second text field gets focus
setfocus testFloater

setForegroundWindow testFocus
setForegroundWindow testFocus.hwnd
setForegroundWindow testFloater

In 3ds Max 6 and higher,

SetFocus() can be used to set focus on ActiveX controls, too.

Was this information helpful?