CheckBox Template repeater

thanks i about ping its throwing error like that

I corrected the code above.

Here is the complete breakdown from the button all the way to the root container:

#event.source = PMIRadioButton
#event.source.parent = Template
#event.source.parent.parent = TemplateRepeater$VerticalView
#event.source.parent.parent.parent = JViewport
#event.source.parent.parent.parent.parent = JideScrollPane
#event.source.parent.parent.parent.parent.parent = TemplateRepeater ###This is the one that has your custom property
#event.source.parent.parent.parent.parent.parent.parent = Root Container
Parent Listing Script:
parents = [event.source]
current_parent = event.source.parent
while current_parent is not None:
	parents.append(current_parent)
	current_parent = current_parent.parent
for i, parent in enumerate(parents):
	print('#event.source{} = {}'.format('.parent' * i, type(parent)))
Full Output for this Usage Case:
#event.source = <type 'com.inductiveautomation.factorypmi.application.components.PMIRadioButton'>
#event.source.parent = <type 'com.inductiveautomation.factorypmi.application.components.template.VisionTemplate'>
#event.source.parent.parent = <type 'com.inductiveautomation.factorypmi.application.components.TemplateRepeater$VerticalView'>
#event.source.parent.parent.parent = <type 'javax.swing.JViewport'>
#event.source.parent.parent.parent.parent = <type 'com.jidesoft.swing.JideScrollPane'>
#event.source.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.factorypmi.application.components.TemplateRepeater'>
#event.source.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.factorypmi.application.components.BasicContainer'>
#event.source.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JLayeredPane'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JRootPane'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.factorypmi.application.FPMIWindow'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.designable.DesignPanel$DesignableContainerLayer'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.designable.DesignPanel$LayerParent'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JViewport'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.designable.DesignPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.factorypmi.designer.workspace.WindowWorkspace'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.WorkspaceManager'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.jidesoft.docking.Workspace'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.IgnitionDockingManager$1'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.IgnitionDockingManager$1'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.IgnitionDockingManager$1'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.IgnitionDockingManager$1'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.jidesoft.docking.DockedFrameContainer'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.IgnitionDockingManager$1'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.jidesoft.docking.DefaultDockingManager$DockedHiddenSlidingContainer'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.jidesoft.docking.DefaultDockingManager$MainPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.jidesoft.action.MainContainer'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.jidesoft.swing.ContentContainer'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JPanel'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JLayeredPane'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'javax.swing.JRootPane'>
#event.source.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent = <type 'com.inductiveautomation.ignition.designer.IgnitionDesigner'>
1 Like

thanks this will very help full for me to understand.. how its working

1 Like

one more question

when i open the window having template repeater. it showing all radio button are deselected

but i want first radio button should be selected my default
image

is there any trick is there?

As far as I know you're in uncharted territory. I've never heard of anybody deploying radio buttons in this manner, so you'll probably just have to experiment with scripting until you get it working. I won't be in a position to test anything for a few hours, but I can imagine that the easiest place to do this from would be the parent window's internalFrameOpened event handler. I imagine that the templates will be indexed from top to bottom, so the one at index zero should be the top one.

The script for retrieving it and setting it will look something like this:

from com.inductiveautomation.factorypmi.application.components import PMIRadioButton
repeater = system.gui.getParentWindow(event).getComponentForPath('Root Container.Template Repeater')
def getRadioButton(repeater):
	if repeater.componentCount > 0:
		for component in repeater.getComponents():
			if isinstance(component, PMIRadioButton) and component.name != 'invisibleButton':
				return component
			else:
				button = getRadioButton(component)
				if button is not None:
					return button
	return None
button = getRadioButton(repeater)
button.setSelected(True)

Note: This is untested, so there is a good chance that something will need to be debugged or corrected, but it should be pretty close to what you need.

1 Like

Actually template repeater i am using it inside a template and i am drag and dropping it to the window

this is template with template repeater that i am calling it in window
image

@justinedwards.jle

Got a way to do that
create a Boolean custom property in radio button and binded that property to selection of radio button

and called that in template repeater dataset
image

1 Like