Skip to content

Commit

Permalink
Fix checkbox alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Zusier committed Nov 22, 2021
1 parent 8923907 commit e2b4a08
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions multichoice/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"log"
"os"
"strings"

Expand All @@ -18,10 +17,9 @@ var inputChoices []string
var outputChoices []string

func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
argsWithoutProg := os.Args[1:]
if len(argsWithoutProg) != 3 {
log.Println("Usage: multichoice Title Prompt Choices;here")
println("Usage: multichoice Title Prompt Choices;here")
os.Exit(1)
}
title := argsWithoutProg[0]
Expand Down Expand Up @@ -66,21 +64,19 @@ func main() {
},
},
}.Create()); err != nil {
log.Fatal(err)
panic(err)
}

mw.Run()
}

func CheckBoxList(choices []string) []Widget {
bs := make([]*walk.CheckBox, len(choices))
children := []Widget{}
for i, name := range choices {
bs[i] = new(walk.CheckBox)
for _, name := range choices {
indexName := name
children = append(children, CheckBox{
AssignTo: &bs[i],
Text: name,
Alignment: AlignHNearVNear, // added
Text: name,
OnClicked: func() {
if i := contains(indexName, outputChoices); i != -1 {
outputChoices = remove(outputChoices, i)
Expand Down

0 comments on commit e2b4a08

Please sign in to comment.