Go to: Synopsis. Return value. Flags. MEL examples.
dimWhen [-clear] [-false] [-true]
string string
dimWhen is undoable, NOT queryable, and NOT editable.
This method attaches the named UI object (first argument) to the named
condition (second argument) so that the object will be dimmed when the
condition is in a particular state.
This command will fail if the object does not exist. If the condition
does not exist (yet), that's okay --- a placeholder will be used until
such a condition comes into existence.
The UI object should be one of two things, either a control or a menu
item.
None
clear, false, true
Long name (short name) |
Argument types |
Properties |
-false(-f)
|
|
|
|
Dim the object when the condition is false.
|
|
-true(-t)
|
|
|
|
Dim the object when the condition is true. (default)
|
|
-clear(-c)
|
|
|
|
Remove the condition on the specified dimmable.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command.
|
// Create a window with a menu item and button that will dim if
// there are no objects selected in the scene.
//
string $window = `window -menuBar true -title "dimWhen Example"`;
menu -label "Edit";
string $menuItem = `menuItem -label "Delete Selection" -command ("delete")`;
columnLayout -adjustableColumn true;
string $button = `button -label "Delete Selection" -command ("delete")`;
// Create a few buttons to create some objects, select all the objects in
// the scene, and clear the selection.
//
button -label "Create Objects" -command ("sphere; cone; cylinder;");
button -label "Select All" -command ("select -all");
button -label "Select Nothing" -command ("select -clear");
// Add the dim conditions.
//
dimWhen -false SomethingSelected $button;
dimWhen -false SomethingSelected $menuItem;
showWindow $window;