Buttno enable set to False


#1

Hi

I am working on a project for university and I decided that would be great to set my buttons to false.

For example
3 buttons - ‘Create1’, ‘Create2’ and ‘Delete All’

when the user will click the button ‘Create1’ the button will set ‘enable’ to ‘False’.
if I click for button ‘Create2’ the ‘enable’ as well will be set to ‘False’

the button ‘Delete All’ will reset those ‘enables’ for all buttons to ‘True’

I am not sure how to do it. I am looking something simply and not long.

Thank you


#2

I suggest to have a look at the docs. You will have to:

[ul]
[li]create a window
[/li][li]create a layout
[/li][li]place buttons in the layout
[/li][li]add command to the buttons
[/li][/ul]

The manuals is full of simple examples.


#3

To change the state of a button, you need to have the command of the button put the button into edit mode.
Not sure if you are writing in MEL or Python, but here is the modified button command example from the docs


window -width 150;
columnLayout -adjustableColumn true;
    button -label "Create 1" -command "buttonPush1" button1;
    button -label "Create 2" -command "buttonPush2" button2;
    button -label "Delete All" -command "buttonPush3" button3;
showWindow;

proc buttonPush1()
{
	print "Button 1 was pushed.
";
	button -edit -enable 0 button1;
}

proc buttonPush2()
{
	print "Button 2 was pushed.
";
	button -edit -enable 0 button2;
}

proc buttonPush3()
{
	print "Button 2 was pushed.
";
	button -edit -enable 1 button1;
	button -edit -enable 1 button2;
}