I ran into a problem using radio groups and tab containers. I have an embedded view with a tab container that has a radio group on one tab. The index property of the radio group is bound to a parameter of the embedded view with the intent being that depending on which station the operator is accessing the view from, the default option for the radio button is different. Here are some screenshots of the source view in a simplified project I made to demonstrate the issue:
The view has an "idx" parameter to which the radio group's index property is bound:
Everything works fine if the source view is saved with the tab containing the radio group active.
However, if the tab containing the radio button is not the active tab when the source view is saved, the selected property of each radio button and the value property of the radio group are not updated:
I am currently circumventing this with a script that fires when the tab is selected:
comp = self.getChild("RadioGroup")
for idx, obj in enumerate(comp.props.radios):
obj.selected = (idx == comp.props.index)
comp.props.value = comp.props.radios[comp.props.index].value if comp.props.index is not None else None
Has anyone else run into this problem and found a better solution? I'm fairly new, so I wouldn't be surprised if there is something simple I'm missing. TIA for any help.
It sounds like 'bi-directional' isn't selected in your binding.
Thanks for the suggestion. I just tried making the binding bi-directional, but my results are the same.
I missed the parameter part. Is the parameter of your 'ViewToLoad' selected as in Input/Output parameter? By default they are created as input only. Just click on the arrow to the left of the view parameter until you see the double arrow.
It is set as "input only". That is the expected behavior for it. I don't need to changes to the index to be visible to the parent screen. I tried changing it anyway, and I'm still seeing the error.
The thing I'm concerned about is that the properties of the radio group don't update if the index is changed when it's not on the active tab.
I modified the demo project, and it turns out this has nothing to do with using an embedded view. Any radio group in a tab container will not update it's value and selected properties if the index is changed when it's not on the active tab:
Hopefully, you can see what's happening based on the 3 screenshots I attached. I'm too new to add more than that. 
Support recommends either solving this with scripting or making the tab with the radio group an embedded view with appropriate input an output parameters. The second approach won't reflect changes to the radio group index until that tab is selected, but it does keep the other radio group properties consistent with the index.
Try adding a runWhileHidden
boolean property to your tab. And set it to true
, obviously.
like this:

Thanks! Looks like there were several pieces to the puzzle. To get the functionality I need, I created a view with an input/output parameter to which the radio group's index is bound. That is then embedded into a tab with the runWhileHidden property set to true, then I'm using a startup script to open and activate the tab in question on startup. The last step is necessary because the tab has to be loaded once before it can run while hidden.
ETA: I'm still waiting on support to tell me if this is a bug. Seems to me like a binding on the index of a radio group should either update all dependent properties or none at all.