View Full Version : popupMenu lacking the commandRepeatable -flag

11 November 2012, 03:49 PM
I've created UI buttons using the iconTextButton -control and then added right-click functionality to them by adding a popupMenu -control that is parented to them. This is exactly the same way Maya does it with it's native buttons in the UV Texture Editor.

One problem with this is that I can't make right-click commands repeatable because the popupMenu -command lacks the commandRepeatable -flag (and it has no substitute).

So what other control can I use that work just as well? I want it invisible, parented and located under the original button.

11 November 2012, 04:55 PM
Generally you can't make UI command callbacks repeatable. What you can do is to use the repeatLast command to manually add the relevent function call into the repeat stack. This has come up before iirc so do a search here for repeatLast.

11 November 2012, 08:02 PM
You really sure about that? I'm asking because the "-commandRepeatable true" -flag seems to work a 100% for me. All iconTextButtons have it right now and it seems like that flag does add the command to the repeat stack.

I took a look at repeatLast and it does look like the right thing to use here.
I don't understand how you are supposed to use it though: Is it to be included in the command call or inside the procedure?

-image1 "edgeColorToggle.bmp"
-command "edgeColorForward()"
-commandRepeatable true
-label "Toggle between edge colors"
-annotation "Toggle between edge colors"

popupMenu -button 3
-parent edgeColorButton
-postMenuCommand "edgeColorBack(); repeatLast -ac edgeColorBack"
Because this does not work. The "edgeColorBack()" is not repeatable - the forward one is though thanks to the commandRepeatable -flag.

CGTalk Moderation
11 November 2012, 08:02 PM
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.