Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

(MEL)checkBox -edit -value not working as expected.

(MEL)checkBox -edit -value not working as expected.

absoluteKelvin
Collaborator Collaborator
500 Views
1 Reply
Message 1 of 2

(MEL)checkBox -edit -value not working as expected.

absoluteKelvin
Collaborator
Collaborator
checkBox -edit -value on 

one would expect that editing the checkBox -value to on would trigger the -onCommand.

 if (`window -exists testCheckBoxUI`) 
 {
     deleteUI testCheckBoxUI;   
 }
window -title "testCheckBox" testCheckBoxUI;
rowColumnLayout -numberOfColumns 3;
textFieldGrp -label "Write Something" -text "" -columnWidth 1 120 -columnWidth 2 235 TFGroup;
checkBox -label "On" -value off -onCommand "textFieldGrp -edit -enable true TFGroup;" -offCommand "textFieldGrp -edit -enable false TFGroup;" firstCheckBox;
checkBox -label "TurnFirstCheckBoxOn" -value off -onCommand "checkBox -edit -value on firstCheckBox;" turnCheckBox;
showWindow testCheckBoxUI;

unfortunately it doesn't. Not sure if its a bug or something im missing. It's wierd to me that editing value of a checkBox does not trigger the onCommand.

https://www.artstation.com/kelvintam
0 Likes
501 Views
1 Reply
Reply (1)
Message 2 of 2

g2m.agent
Collaborator
Collaborator

I think you just set a value of the "firstCheckBox", and this value will not be automatically connected to "TFGroup". You should build a function that can assign values to both. something like this:

proc setOn(){
	checkBox -edit -value on firstCheckBox;
	textFieldGrp -edit -enable true TFGroup;	
}

if (`window -exists testCheckBoxUI`){
     deleteUI testCheckBoxUI;   
}
window -title "testCheckBox" testCheckBoxUI;
rowColumnLayout -numberOfColumns 3;
textFieldGrp -label "Write Something" -text "" -columnWidth 1 120 -columnWidth 2 235 TFGroup;
checkBox -label "On" -value off -onCommand "textFieldGrp -edit -enable true TFGroup;" -offCommand "textFieldGrp -edit -enable false TFGroup;" firstCheckBox;
checkBox -label "TurnFirstCheckBoxOn" -value off -onCommand "setOn();" turnCheckBox;
showWindow testCheckBoxUI;

 

0 Likes