fixed uncontrolled input radio list

This commit is contained in:
paul
2025-03-25 05:24:37 +05:30
parent ede5f276cf
commit 5004dd140e
5 changed files with 20 additions and 20 deletions

View File

@@ -127,25 +127,30 @@ export class RadioButton extends TkinterWidgetBase{
// FIXME: the radio buttons are not visible because of the default heigh provided
static widgetType = "radio_button"
static displayName = "Radio Button"
constructor(props) {
super(props)
this.minSize = {width: 50, height: 30}
let newAttrs = removeKeyFromObject("layout", this.state.attrs)
this.state = {
...this.state,
size: { width: 80, height: 30 },
fitContent: { width: true, height: true },
widgetName: "Radio button",
attrs: {
...this.state.attrs,
...newAttrs,
radios: {
label: "Radio Group",
tool: Tools.INPUT_RADIO_LIST,
value: {inputs: ["default"], selectedRadio: -1},
value: {inputs: ["default"], selectedRadio: null},
onChange: ({inputs, selectedRadio}) => {
this.setAttrValue("radios", {inputs, selectedRadio})
this.setAttrValue("radios", {inputs, selectedRadio}, () => {
console.log("attribute set: ", this.state.attrs.radios, {inputs, selectedRadio},)
})
}
}