How can I toggle on/off a radial button?

Hi, I have a radio in a dialog. I can only toggle it on, the first time I click it. The onclick function is run only on the first click too.

dlg:file{
        id = "filepath",
        title = "Choose a name for your file",
        open = false,
        save = true,
        filetypes = {'png', 'jpg', 'jpeg', 'gif'},
        onchange = function()
            local data = dlg.data
            saveLayer(data.filepath)
            dlg:close()
        end
    }:radio{
        id = "only_visible",
        text = "Export only Visible",
        onclick = function()
            print(dlg.data.only_visible)
        end
    }:button{
        id = "cancel",
        text = "Cancel",
        onclick = function()
            dlg:close()
        end
    }

Thanks

i might be wrong, but i always thought ‘radio’ button is switch between A and B options, not ON and OFF, so in this case one shoud use checkbox (check) instead.

That was it, seems like I missed that when I saw the docs, thanks!

1 Like