Skip to content

Commit e2b4a08

Browse files
committed
Fix checkbox alignment
1 parent 8923907 commit e2b4a08

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

multichoice/main.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"log"
54
"os"
65
"strings"
76

@@ -18,10 +17,9 @@ var inputChoices []string
1817
var outputChoices []string
1918

2019
func main() {
21-
log.SetFlags(log.LstdFlags | log.Lshortfile)
2220
argsWithoutProg := os.Args[1:]
2321
if len(argsWithoutProg) != 3 {
24-
log.Println("Usage: multichoice Title Prompt Choices;here")
22+
println("Usage: multichoice Title Prompt Choices;here")
2523
os.Exit(1)
2624
}
2725
title := argsWithoutProg[0]
@@ -66,21 +64,19 @@ func main() {
6664
},
6765
},
6866
}.Create()); err != nil {
69-
log.Fatal(err)
67+
panic(err)
7068
}
7169

7270
mw.Run()
7371
}
7472

7573
func CheckBoxList(choices []string) []Widget {
76-
bs := make([]*walk.CheckBox, len(choices))
7774
children := []Widget{}
78-
for i, name := range choices {
79-
bs[i] = new(walk.CheckBox)
75+
for _, name := range choices {
8076
indexName := name
8177
children = append(children, CheckBox{
82-
AssignTo: &bs[i],
83-
Text: name,
78+
Alignment: AlignHNearVNear, // added
79+
Text: name,
8480
OnClicked: func() {
8581
if i := contains(indexName, outputChoices); i != -1 {
8682
outputChoices = remove(outputChoices, i)

0 commit comments

Comments
 (0)