Setfocus problem


#1

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 ?


#2

setfocus ?

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

#3

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


#4

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


#5

sme.setfocus()
– Unknown property: “setFocus” in Interface:SME
– MAXScript callstack:
– thread data: threadID:13472


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


#7

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