-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
56 lines (51 loc) · 1.18 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"context"
"github.com/lxn/walk"
d "github.com/lxn/walk/declarative"
)
func main() {
ctx := context.Background()
var mw *walk.MainWindow
var tv *walk.TableView
var q *walk.LineEdit
agent, err := NewNTFSAgent(ctx, "c:\\")
if err != nil {
return
}
fileModel := NewFileInfoModel(agent)
d.MainWindow{
AssignTo: &mw,
Title: "NTFS Search",
Size: d.Size{Width: 800, Height: 600},
Layout: d.VBox{Margins: d.Margins{Left: 2, Top: 2, Right: 2, Bottom: 2}},
Children: []d.Widget{
d.Composite{
Layout: d.HBox{MarginsZero: true},
Children: []d.Widget{
d.LineEdit{
AssignTo: &q,
OnTextChanged: func() {
fileModel.SetQuery(q.Text())
},
},
d.PushButton{
Text: "Settings",
},
},
},
d.TableView{
AssignTo: &tv,
ColumnsOrderable: true,
MultiSelection: true,
Columns: []d.TableViewColumn{
{DataMember: "Name", Width: 192},
{DataMember: "Path", Width: 192},
{DataMember: "Size", Format: "%d", Alignment: d.AlignFar, Width: 64},
{DataMember: "Modified", Format: "2006-01-02 15:04:05", Width: 120},
},
Model: fileModel,
},
},
}.Run()
}