Logic for mutually-exclusive checkboxes?

I have several checkboxes that I want to use, and if one checkbox has a selected value of True, I want the other ones to all be false.

The current logic I have is this, on propertychange:

'Logic for first checkbox
if (event.source.parent.getComponent('2ndChk').selected == True):
	event.source.parent.getComponent('2ndChk').selected=False

'Logic for second checkbox
if (event.source.parent.getComponent('1stChk').selected == True):
	event.source.parent.getComponent('1stChk').selected=False

I’m thinking I should be using the newValue features, but I haven’t been able to actually access them

This seems like a job for a Radio Button. Groups of radio buttons are designed to be mutually exclusive by default.

3 Likes