transferring only the checked RadioButton from a group

Dear all,

I created a Validator subclass to transfer the settings of RadioButtons, CheckbBoxes - this only transfers, no validation occurs. See the code attached.

The transfer works OK, but for a group of RadioButtons I get the settings for all of them. As these are mutually exclusive choices in the case of the RadioButtons, the information is redundant and makes life a bit complicated downstream. For CheckBoxes this is OK.

Is there a way to find all radio buttons in a group? The problem would be split in two (CheckBox/RadioButton) and the TrasferTo/TransferFrom methods could then be modified for the RadioButtons to transfer a single value only.

Thanks in advance for any help!

transfer_example.py (677 Bytes)

So the solution for now is a subclass of the previously attached TransferValidator class, used for Radiobuttons only. As choices are mutually exclusive, only the one chosen is transferred.

class RadioButtonTransferValidator(TransferValidator):

    def TransferFromWindow(self):
        window = self.GetWindow()
        _val = window.GetValue()
        if _val:
            window.dialog.widget_data[window.GetName()] = _val
        return True

    def Clone(self):
        return RadioButtonTransferValidator() # a must

···

On Saturday, May 4, 2019 at 6:17:48 AM UTC+2, Jakab Gábor wrote:

Dear all,

I created a Validator subclass to transfer the settings of RadioButtons, CheckbBoxes - this only transfers, no validation occurs. See the code attached.

The transfer works OK, but for a group of RadioButtons I get the settings for all of them. As these are mutually exclusive choices in the case of the RadioButtons, the information is redundant and makes life a bit complicated downstream. For CheckBoxes this is OK.

Is there a way to find all radio buttons in a group? The problem would be split in two (CheckBox/RadioButton) and the TrasferTo/TransferFrom methods could then be modified for the RadioButtons to transfer a single value only.

Thanks in advance for any help!