CheckBox Template repeater


I would like to use checkbox as a template in vision and it will be repeated as per the selection in a radio button.

For eg: If i have selected 'Equipment Failure' , i should be able to select only one option from subcategory which is a repeater.
Currently multiple selection is possible which i would like to restrict.
Any ideas to achieve this?

Radio buttons are tied to each other if they're in the same container. Because yours are all container in their own template, they are all independent. I don't think you'll be able to use the default functionality, you will probably need to read the current state into your radio button template and fire a script to deselect the buttons that aren't on

Add this script to your checkbox's actionPerformed script, and you should get the effect you want:

for component in event.source.parent.parent.getComponents():
	for subComponent in component.getComponents():
		if subComponent != event.source:
			subComponent.selected = False
1 Like

Using checkboxes for that functionality is bad GUI design and will cause confusion.

  • Radio buttons are "interlocked" and one and only one can be selected.
  • Checkboxes are independent and multiple (or none) can be selected.

You should be using radio buttons for the sub-categories as well.

1 Like

I totally missed the mention of check boxes, haha. I just assumed they were radio buttons.

Hi ,

same script i tired for radio button its not working

anything needs to be alter for radio button?

Is your radio button in a template repeater?

If so, is it in a nested container within the template?

i have one radio button in template

i am calling template in template repeater (repeater placed in root container of window) and given count 5.

but when i switch from one radio button to another its not deselecting

You're running into a fundamental radio button behavior. The template acts as a container, so without another radio button in the template, the setSelected method is not going to work without some creative hocus pocus.

A simple way to do it would be to put a second radio button with a special name in the template with the visibility set to false, and then programmatically set the invisible radio button to setSelected(True) to deselect the visible radio button

1 Like


Okay, I've tested the below script, and it works. If you name your invisible radio button: 'invisibleButton', and put the following script on the VISIBLE button's actionPerformed event handler, it will give you the result you are looking for:

rootButton = event.source.parent.getComponent('invisibleButton')
for component in event.source.parent.parent.getComponents():
	for subComponent in component.getComponents():
		if subComponent != rootButton and == 'invisibleButton':
			subComponent.selected = True
1 Like

thank you so much

1 Like

Hi @justinedwards.jle

one question
i have 3 check box in template repeater

i want them to be align from center

but it starting from right top

i justed the flow direction also but it's not changing anything i am missing here?


Got it this is the setting we need to use


how to fetch the selected button name from template repeater?

example -
in my image matline selected.. i want to fetch that name
i tired but don't know how to get it

1 Like

From where or when are you wanting to get it?

when selection changes. i planning to get it in template repeater property change.

is there any better way to get it.. i really don't know

based on the selection name i need to run some script that's is my goal

it's good to get it in template repeater custom property

It's not the name you're after; it's the text. Assign it to your custom property from the VISIBLE button's actionPerformed event script. It will simply be: event.source.text.

yes i need the text based on the selection change

but i didn't getting what you ask me to do

when selection changes nothing is happening in template repeater property. that's why i don't know how to fetch it

if write the script in template action performed but how to right back that to template repeater custom property?

You have a custom property on the template REPEATER?

What is it called, and what datatype is it?

workshopName (string datatype)

The template is the button's parent, and the repeater is the template's parent, so the code will look like this:

event.source.parent.parent.parent.parent.parent.workshopName = event.source.text

Edit: Oops! @prasath.t, I just tested it, and the parent of the template is actually the scroll pane. You'll have to go a few layers higher to get to the repeater. I've corrected the code accordingly.

1 Like