View Full Version : Activating a button with the Enter key?
01-07-2004, 11:23 PM
The title pretty much says it all. I'm working on a tiny little renaming script... something that'll just let me press ctrl-R and rename whatever's selected by filling in a textField.
The idea is to get away from a great deal of mouse-clicking. (for example, I'd like to be able to step through the hierarchy of a skeleton and rename things using only the keyboard) It seems as if the only time I'll need to use the mouse is to click the "rename" button in my rename UI window... is there a way to say to mel "When Enter is pressed, execute the command"?
01-08-2004, 12:11 AM
If you work with a textField you should use this:
-ec/enterCommand string ----- Command executed when the keypad 'Enter' key is pressed.
This comes straight out the docs.
:: Galactor ::
01-08-2004, 12:18 AM
Ah... thanks Galactor.
I was using a textFieldButtonGroup. I do my best to read the docs carefully, but it looks like the textFieldButtonGroup doesn't have the -ec flag. Thanks for pointing me in the right direction! :)
01-08-2004, 01:30 AM
the -ec flag only works with the numeric keypad enter tho... not the standard enter. or so i've found anyway. :)
01-08-2004, 01:42 AM
I've been testing it out, and the regular enter key seems to work just fine. However, there's two caveats to my testimony:
1) I'm using a Mac
2) It's a laptop: hence, no numberic keypad or second 'return' key
I don't know if either of those make a difference... but in any case, my regular 'return' key works just fine with the -ec flag.
01-08-2004, 01:44 AM
fair enough... i could very well be wrong on that count.
incedentally, if you're using a laptop, ctrl-enter is the same as the numeric keypad enter. :)
i work on a laptop too. presumably being on a mac doesn't make a difference, but don't quote me there. :)
01-08-2004, 02:04 AM
Okay, so I gotta ask now... what is the difference between the standard 'enter' and the numeric keypad's 'enter'?
I've always seen them both, but they looked like they did the same thing. Do they not?
01-08-2004, 03:20 AM
the numric keypad enter can be used to execute code in the script editor. if you hit the numeric keypad enter in the script editor, it will execute all the code there. or all of the selected code if there is any.
ctrl-enter does the same thing.
apart from that, they're both do pretty much the same thing.
01-08-2004, 03:42 AM
I just thought that ctrl-Enter executed the code. I didn't know it was a workaround for not having a numberic keypad enter.
Thanks for the info! :)
01-08-2004, 08:20 AM
for a rename script i used the promptDialog command, which until version 5.0 (or was it even 4.5) was working very very well with minimal coding needs.
enter brought you out of it as wanted.
since the higher versions of maya alias unfortunately changed the behaviour of that (and some other commands), that now you need to really press the "OK" button which is extremely stupid and serves no purpose..
i reported that to alias and hope the old behaviour comes back in the next maya version.
01-08-2004, 08:45 AM
I didn't know about the promptDialog ... pretty cool. The MEL command reference even gives an example of a quick renaming script (though it seems to leave out the actual renaming, unless I'm missing something)
In any case, it appears as though the 'enter' key actually activates the "OK" button without having to click on it... I'm using version 5.0 It doesn't do this for you?
01-08-2004, 08:52 AM
no it does not do that for me.
i use 5.01 as well, and got the confirmation from alias..
that must be a mac thing indeed, that the enter activation works..
for me it is now that i have to press TAB and then return which is more or less ok..
but nice if it works for you..
01-17-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.