Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possiblein Mel to press "enter" like you would on the keyboard?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
malcolm_341
468 Views, 5 Replies

Is it possiblein Mel to press "enter" like you would on the keyboard?

Hi, I've run into a bug and I'm wondering if there's a workaround. I have a textField in my window, when the window is launched the text field is highlighted in blue which I don't want because if you press anything on the keyboard it will start typing in the textField which is annoying. I discovered you can use -enableKeyboardFocus 0 to stop this from happening for floatFields, and while that command is supported for textFields it has a bug that also makes the text field locked and you can't type anything into it.

 

So I'm wondering does anyone have a workaround or is there a way to press enter or lose focus on that textField as I open my window? The -changeCommand  won't work unfortunately, what I need is something that acts the same as keyboard input. Or any other workaround is appreciated.

5 REPLIES 5
Message 2 of 6
osidedan
in reply to: malcolm_341

Total guess, and this would be hacky haha,  but you could maybe create a temp text field (or some other ui element) after the text field in question, and then delete or hide that temp text field from the layout when you draw the window? Might be enough to get the keyboard focus off of your initial text field.

Message 3 of 6
malcolm_341
in reply to: osidedan

I'll look into, it might just put the focus on the invisible one. Deleting it I don't think is an option because then it would make the window longer than it needs to be.

Message 4 of 6

maybe use setFocus to focus on the main window instead?

https://www.artstation.com/kelvintam
Message 5 of 6

Thanks for your reply, I had actually tried that before posting, but the downside to that is each time you click a button on the window the Maya window border and the toolbox flash white because it's switching focus which is a bit too distracting as a solution unfortunately.

Message 6 of 6
malcolm_341
in reply to: malcolm_341

I found a work around. Leaving the textFields as default settings so you can type into it, then setting all the floatFields to -enableKeyboardFocus 0, then set the first button in the tool to -enableKeyboardFocus 1, this keeps the textField from getting highlighted on toolbox launch and keeps the focus on the main Maya window if you use keyboard input to scale or rotate for example.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report