View Full Version : menuItemīs "-collection" flag?

05 May 2003, 04:19 PM
Hi guys-

I need some help understanding the "-collection" flag in the menuItem command.

I have a script which is dynamically adding menuItems with submenus to a popup menu (it adds menuItems based on cameras and image planes found in the scene). However, Iīm getting errors (only sometimes, strangely) with these submenu menuItems: "Error... : Collection not found, or no current collection."

When the error occurs, it is found in a line that contains a menuItem with a radioButton. I was looking again over the menuItem flags in the MEL docs, and saw the "-collection" flag, although there are no examples of this flag, and the definition of this flag is "-cl/collection string: To explicitly add a radio menu item to a collection." What does that mean? Apparently I should create a collection somewhere and add the menuItems to this collection, but where and how???


05 May 2003, 07:07 PM
A collection is an object that binds a group of radio buttons together so that when one turns on, the others turn off. Have a look at the radio button examples in the documentation, then be sure to make a collection object prior to your radio button menu items. Put the menu items in the collection at creation time with the -collection flag and that's all there is to it.

-- Mark

12 December 2003, 12:20 AM
Is it possible to have a button that deselects all the radio buttons in a given radioButtonGrp?

I have an interface tab with several groups of radio buttons, and I'd like to have one "Master Reset" button to return them all to their default, unselected state.

At this time the radioButtonGrp's are not explicitly placed in a collection.

columnLayout -columnWidth 338 -height 312 -width 338`;

-numberOfRadioButtons 2
-label "Blah"
-labelArray2 "Blah1" "Blah2"


12 December 2003, 01:13 AM
david: to create a radio button collection, just use:

radioCollection someSortOfName;

and then when you create a radion button, just use:

radioButton -l "oh yeah!" -cl someSortOfName;

hope that helps ya!

12 December 2003, 01:39 AM

Originally posted by dmeyer
Is it possible to have a button that deselects all the radio buttons in a given radioButtonGrp?

by the nature of radiobuttons that is not possible; you can do it with checkboxes though; an example how to make that work you can find in this thread:


CGTalk Moderation
01 January 2006, 06: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.