Created
May 14, 2018 04:38
-
-
Save a46554/de92f982ae893eccfc3735d6a153bd1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2017 The Walk Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"github.com/lxn/walk" | |
. "github.com/lxn/walk/declarative" | |
) | |
func main() { | |
var connPB, exitPB *walk.PushButton | |
var comCB *walk.ComboBox | |
data := make([]string, 3) | |
data = []string{"123", "456", "789"} | |
if _, err := (MainWindow{ | |
Title: "ComboBox Button", | |
Layout: VBox{}, | |
Children: []Widget{ | |
HSplitter{ | |
Children: []Widget{ | |
Label{ | |
Text: "ComboBox:", | |
}, | |
ComboBox{ | |
AssignTo: &comCB, | |
Editable: false, | |
Model: data, | |
}, | |
PushButton{ | |
AssignTo: &connPB, | |
Text: "Show", | |
OnClicked: func() { | |
fmt.Println("Show " + data[comCB.CurrentIndex()]) | |
}, | |
}, | |
}, | |
}, | |
PushButton{ | |
AssignTo: &exitPB, | |
Text: "Exit", | |
OnClicked: func() { | |
fmt.Println("Exit") | |
os.Exit(0) | |
}, | |
}, | |
}, | |
}).Run(); err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment