PDA

View Full Version : Two questions about buttons


Camaro
02-14-2011, 10:54 PM
So I've been making a character GUI lately, and one of the things I would like to be able to do is have shift-select and control-select functionality for the controls on the character. I've seen this in scripts but haven't been able to figure out how they did it. I tried using the -doubleClickCommand flag with an iconTextButton, but I'd rather have that shift and control select functionality instead, namely with regular old buttons.

The other thing I want to do is change the actual button when the mouse moves over it. This should be possible in at least 2011 with the new Qt UI, because the button noticeably changes ever so slightly when you mouse over. But I simply couldn't find any commands or flags that relate to the mouse position and whether or not it's over a button. So I'm thinking this is something that is being done under the hood, and that we don't have access to, which is unfortunate.

Any thoughts on either of these two issues is appreciated in advance.

mlefevre
02-14-2011, 11:48 PM
edit*
for question 1, this looks like it might be what your after. (http://forums.cgsociety.org/showthread.php?t=232291)
i'm not too sure about the docs for this command, the example didn't seem to work. (bit value?).

not sure about q 2. sorry.

Camaro
02-15-2011, 12:56 AM
Sweet, that helps, thanks.

Thoughts on the second one are still appreciated.

NaughtyNathan
02-15-2011, 09:22 AM
did you actually read the docs for iconTextButton?! :D ;)

-highlightImage (-hi)
Highlight image displayed while the cursor is over the control
This functionality has been around since Maya 1.0 (probably ;) )
:nathaN

Camaro
02-16-2011, 02:01 AM
No Nathan, because I'm looking for that same functionality but for regular buttons. The difference is that I don't need an image, but for example I would need the button to change color. Besides the fact that it is a Windows only flag, which doesn't do much good.

I suppose if it works, I can't complain though.

NateH
02-16-2011, 03:17 PM
To change that you would need to use PyQt/Qt, Maya only allows you to change the background color, not the highlight color. A Qt stylesheet would can do it pretty simply.

whisperwing
02-18-2011, 04:17 AM
you can do that with pyqt, subclass button and override the mouse events.

Sweet, that helps, thanks.

Thoughts on the second one are still appreciated.

Camaro
02-19-2011, 05:24 AM
Ok...so then the question becomes how do I access PyQt classes from within Maya? Is it built in?

NateH
02-19-2011, 05:28 AM
PyQt is not built in unfortunately. I have pre-compiled versions to use with Maya 2011 on my website:
PyQt Maya x86 (http://nathanhorne.com/?p=229)
PyQt Maya x64 (http://nathanhorne.com/?p=204)

CGTalk Moderation
02-19-2011, 05:28 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.