PDA

View Full Version : modifier keys for UI controls


Reeks
05-29-2012, 09:37 AM
Heyya good folks,
Does anyone have any advice for adding a modifier to a mousebutton click on UI controls ?

Tight on space in a current minimal UI, I'd like to add right click and alt-left click on my mel UI controls. So far I can only see it accepting left clicks.

I've used RMB menus in the past, but I'm looking for single right click functionality.

doffer
05-29-2012, 10:06 AM
Hi Reeks

I think I've done what you are looking for in a script of mine.
Perhaps you can adapt this piece of code?
Appologies if I misunderstand your question.

This creates a pop up menu on the button when right clicking

string $L_Wrist = `button -l "" -w 40 -h 40 -bgc 0.8 0.3 .3 -c "L_Arm(4)"`; popupMenu;

menuItem -l Rot -c "L_Arm(10)"; menuItem -l Tran -c "L_Arm(9)";



And this checks for modifiers (shift in this case)
proc string selectFlag() {

if (`getModifiers` == 1)

return "-tgl";

else

return "-r";

}



So if you wan't to do selection for instance, you'd do:

string $flag = selectFlag(); select $flag ($gPrefix+$Char+":clav_fk_L_CTRL");


Hope it helps a bit
I'm by no means an expert

Reeks
05-30-2012, 06:24 AM
Doffer, thank you SO much!

Yes, it was the "getModifiers" command I simply needed to do more research on. Your example did help as well, so now I have a much more intuitve (for me) interface using ALT and CTRL variants.

Many, many thanks
:)RH

CGTalk Moderation
05-30-2012, 06:24 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.