Setfocus problem


i have a window that is in focus

and i have a macroscript button on the toolbar that when pressed it would do some stuff to the focused window

the problem is the whenever i press the button it steals the focus from the window

any idea around this ?


setfocus ?

rollout testFocus "Test Focus"
        edittext text1 "Test"
        edittext text2 "Focus"
    createDialog testFocus 200 100
    setFocus testFocus.text2 --the second text field gets focus!


unfortunately its not a dialog rather a native 3ds max’s widnow like the slate material editor for example


then try SetForegroundWindow, but slate editor that you mentioned actually has .SetFocus() function


– Unknown property: “setFocus” in Interface:SME
– MAXScript callstack:
– thread data: threadID:13472

– [stack level: 0]
– In top-level


it is the method of Interface: WndBase so you need to access it like this (SME.GetMainframe()).SetFocus

can i give order to second window in the z order ?

if you want z-reorder windows look at this example