I have two sets of check boxes and one is being used to control which options are enabled on the other. I seem to have run into an issue using Enable and Enable Item. If I have previously disabled all the checkboxes I am unable to enable them individually unless I enable them all first. Conversly, if I disable individual check boxes, it appears I am unable to enable them all at once.
As it is currently, if one machine is selected certain boxes disable. However, I am unable to get them to re-enable using Enable(1).
I have attached the code for my window below. I am hoping there is something I am missing and I don't need to use enable items for everything as that will get cumbersome as I continue and if new machines are added in the future.
New Window("XYZTEC Sensor Verification",
<<MODAL></MODAL>I have revised my enable/disable code to only use enable items and it works better now.
However, I still do not understand how I would set the sensor check boxes if multiple machine check boxes are selected. I have included by revised enable/disable code.
Is there an easier way to do this that I am unaware of?
machine << setFunction(
Function({this, button},
If (button == 3,
(If (this << get(button),
(machine << Set(1,0); sensor << Enable Item(1,1); sensor << Enable Item(2,0); sensor << Enable Item(3,1); sensor << Enable Item(4,1); sensor << Enable Item(5,1); sensor << Enable Item(6,1); sensor << Enable Item(7,1))
)),
If (button == 2,
(If (this << get(button),
(machine << Set(1,0); sensor << Enable Item(1,1); sensor << Enable Item(2,1); sensor << Enable Item(3,0); sensor << Enable Item(4,0); sensor << Enable Item(5,0); sensor << Enable Item(6,1); sensor << Enable Item(7,1))
)),
If (button == 1,
(If (this << get(button),
(machine << Set All(1); sensor << Enable Item(1,1); sensor << Enable Item(2,1); sensor << Enable Item(3,1); sensor << Enable Item(4,1); sensor << Enable Item(5,1); sensor << Enable Item(6,1); sensor << Enable Item(7,1); sensor << Set All(1)),
(machine << Set All(0); sensor << Enable Item(1,0); sensor << Enable Item(2,0); sensor << Enable Item(3,0); sensor << Enable Item(4,0); sensor << Enable Item(5,0); sensor << Enable Item(6,0); sensor << Enable Item(7,0); sensor << Set All(0))
))
)
)
)
)
)