initial options bug fixed

See
424f62327b

Thanks a lot for the fast support, amazing!
This commit is contained in:
2024-06-08 20:06:02 +02:00
parent 3c992a00c6
commit 4f7cf4c419
4 changed files with 16 additions and 5 deletions

View File

@@ -42,11 +42,17 @@ func NewMenuButton(
func NewCheckbox(
text string,
initialvalue bool,
action func(args *widget.CheckboxChangedEventArgs)) *widget.LabeledCheckbox {
checkboxImage, _ := LoadCheckboxImage()
buttonImage, _ := LoadButtonImage()
var state widget.WidgetState
if initialvalue {
state = widget.WidgetChecked
}
return widget.NewLabeledCheckbox(
widget.LabeledCheckboxOpts.CheckboxOpts(
widget.CheckboxOpts.ButtonOpts(
@@ -54,6 +60,7 @@ func NewCheckbox(
),
widget.CheckboxOpts.Image(checkboxImage),
widget.CheckboxOpts.StateChangedHandler(action),
widget.CheckboxOpts.InitialState(state),
),
widget.LabeledCheckboxOpts.LabelOpts(
widget.LabelOpts.Text(text, *FontRenderer.FontSmall,