Notifications
Clear all

[Closed] Controlling the focus

Hi all!

I just build a “Go to time” script today a la After Effects and combustion that creates a floating dialog that I enter the value, press enter and it closes. But when after that the focus goes somewhere else and shortcuts doesn’t work until I click something…

So the question is, how can I bring the focus back to the viewport for shorcuts to work again after the dialog is closed? Couldn’t find that in the help…

Thanks in advance…

Jr.

5 Replies

I don’t know if this will help, but you could try setting the active viewport…

viewport.activeviewport = 1

or something like it…or you might be able to change the current command panel mode using something like

max create mode

This might be enough to draw focus

Shane

Thanks for the answer…but I already tried the viewport thing and it didn’t work, sorry for not advising…my bad…:sad:

Just to note, I tried to use #escape too with no sucess…

I will try your other suggestion…

Regards,

Jr.

OK guys, now this thing got on my nerves. I can’t get it to work on my own, I REALLY need some light here…

To resume the situation is that for an editable text when I enter something on it (and destroy de dialog via script after entered the text), I can’t have the focus back to max until I right click the viewport. I tried everything I could think of with no sucess…

I just can’t believe no one here knows a solution for that…any help are MUCH appreciated…

Regards,

Jr.

Hi
try this

try ( toolmode.commandmode = toolmode.commandmode) catch ()

this helped me.

1 Reply
(@eugenio)
Joined: 11 months ago

Posts: 0

Hi mir-vadim! To me it’s not working…WTF!!! I’m already giving up on this one…

I did a simple test that shows pretty well the problem (After you entered the value, shortcuts no longer work until I rightclick the viewport (must be in the viewport)):

macroScript Macro1
category:"DragAndDrop"
toolTip:""
(
rollout unnamedRollout "Untitled" width:160 height:32
(
editText edt1 "Go To Time" pos:[8,8] width:144 height:16
on edt1 entered text do
(
sliderTime += text as time
destroyDialog unnamedRollout
toolmode.commandmode = toolmode.commandmode
)
)
createDialog unnamedRollout
setFocus unnamedRollout.edt1
)