dropfiles.go 652 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2013 The Walk Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package main
  5. import (
  6. "strings"
  7. "github.com/lxn/walk"
  8. . "github.com/lxn/walk/declarative"
  9. )
  10. func main() {
  11. var textEdit *walk.TextEdit
  12. MainWindow{
  13. Title: "Walk DropFiles Example",
  14. MinSize: Size{320, 240},
  15. Layout: VBox{},
  16. OnDropFiles: func(files []string) {
  17. textEdit.SetText(strings.Join(files, "\r\n"))
  18. },
  19. Children: []Widget{
  20. TextEdit{
  21. AssignTo: &textEdit,
  22. ReadOnly: true,
  23. Text: "Drop files here, from windows explorer...",
  24. },
  25. },
  26. }.Run()
  27. }