ScriptSpot

Forum topic · General Scripting

go to frame

By titane357 · 2012-09-13

Description

hello,
I'd like to clic a key -> open window, tape a value and clic enter (numeric)
and voilà : I have set new timeframe.
but I don't know how to validate the value with enter key, I don't want to clic on the "go" button.... please, any idea ?
------------------------------------------------------------
try destroyDialog rlMover catch()
global rlMover = rollout rlMover "GO2frame"
(
button butconnect "GO" pos:[2,2]
spinner spX "X " width:90 range:[0,5000,1] type:#integer pos:[55,5]
on spX KeyDOwn evnt do
if evnt.KeyCode == (dotNetClass "System.Windows.Forms.Keys").Enter do
(
sliderTime = spX.value
)
)
createDialog rlMover 160 25
setFocus rlMover.spX
------------------------------------------------------------

Comments (4)

barigazy · 2012-09-13

you need to use (dotNetControl "NumericUpDown") if you use keydown event.Thats way not works.

barigazy · 2012-09-13

use "Return" instead of "Enter"

if (evnt.KeyCode as string) == "Return" do ...


or you can use keyValue like this

if evnt.keyValue == 13 do ...


try this script to see KeyCode or keyValues of keyboard keys

http://www.scriptspot.com/3ds-max/scripts/key-value

titane357 · 2012-09-13

thanks for answer, but unfortunally it don't work for me...
instead I use change value, that's do the trick...
-----------------------------------------------------
(
try destroyDialog rlMover catch()
global rlMover = rollout rlMover " GO2frame"
(
spinner spX ">>> FRAME " width:150 range:[0,5000,1] type:#integer pos:[5,5]
on spX changed val do
(
sliderTime = spX.value
)
)
createDialog rlMover 160 25
setFocus rlMover.spX
)
---------------------------------------------------------

hey Titane!

Anubis · 2012-09-18

Why you use "changed" event of the spinner
then you have "entered"?

on spX entered do ( ... )