From 3a69783d3b31b386c3189584b24574f2e99d58d0 Mon Sep 17 00:00:00 2001 From: xphlawlessx Date: Tue, 6 Oct 2020 14:03:53 +0100 Subject: [PATCH 1/4] Updated -README.mdown I broke down the example to try and illustrate the component parts more clearly it's a start - Could do with lists of fields/ widgets , maybe a few more examples --- README.mdown | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/README.mdown b/README.mdown index fc67ca464..04c6fde19 100644 --- a/README.mdown +++ b/README.mdown @@ -22,7 +22,6 @@ Using Walk The preferred way to create GUIs with Walk is to use its declarative sub package, as illustrated in this small example: - ##### `test.go` ```go @@ -58,6 +57,59 @@ func main() { }.Run() } ``` +A slightly more detailed broken down example: +========== +A window is created with MainWindow {} +Fields for Title ,MinSize and Layout should always be set. +Layouts include VBox{} (layout widgets in a top-bot list) and HBox{} (layout widgets in a left-right list) , these should be enough for a large number of cases. +Remember to call .Run() to open the window + +```go +package main + +import ( + "github.com/lxn/walk" + . "github.com/lxn/walk/declarative" +) + +func main() { + + MainWindow{ + Title: "WindowTest", + MinSize: Size{600, 400}, + Layout: VBox{}, + }.Run() + +``` + +========== +A field for Children takes a slice of Widget structs (lxn base class for UI widgets) +Fields in widgets include AssignTo for data binding (Note the use of *pointer and &derefrence) + +```go +package main + +import ( + "github.com/lxn/walk" + . "github.com/lxn/walk/declarative" +) + +func main() { + var aTextEdit *walk.TextEdit + + MainWindow{ + Title: "ChildrenTest", + MinSize: Size{600, 400}, + Layout: VBox{}, + Children: []Widget + { + TextEdit{AssignTo: &inTE}, + TextEdit{}, + }.Run() + +``` + + ##### Create Manifest `test.manifest` From 8759e56d81613e1091309ab9db95599399bf9a9a Mon Sep 17 00:00:00 2001 From: xphlawlessx Date: Tue, 6 Oct 2020 14:08:28 +0100 Subject: [PATCH 2/4] Updated -README.mdown I broke down the example to try and illustrate the component parts more clearly it's a start - Could do with lists of fields/ widgets , maybe a few more examples (EDIT) fixed a few formatting errors. --- README.mdown | 82 ++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/README.mdown b/README.mdown index 04c6fde19..4820fc5a4 100644 --- a/README.mdown +++ b/README.mdown @@ -56,59 +56,59 @@ func main() { }, }.Run() } -``` -A slightly more detailed broken down example: -========== -A window is created with MainWindow {} -Fields for Title ,MinSize and Layout should always be set. -Layouts include VBox{} (layout widgets in a top-bot list) and HBox{} (layout widgets in a left-right list) , these should be enough for a large number of cases. -Remember to call .Run() to open the window -```go -package main -import ( - "github.com/lxn/walk" - . "github.com/lxn/walk/declarative" -) + A slightly more detailed broken down example: + ========== -func main() { + A window is created with MainWindow {} + Fields for Title ,MinSize and Layout should always be set. + Layouts include VBox{} (layout widgets in a top-bot list) and HBox{} (layout widgets in a left-right list) , these should be enough for a large number of cases. + Remember to call .Run() to open the window - MainWindow{ - Title: "WindowTest", - MinSize: Size{600, 400}, - Layout: VBox{}, - }.Run() + ```go + package main -``` + import ( + "github.com/lxn/walk" + . "github.com/lxn/walk/declarative" + ) -========== -A field for Children takes a slice of Widget structs (lxn base class for UI widgets) -Fields in widgets include AssignTo for data binding (Note the use of *pointer and &derefrence) + func main() { -```go -package main + MainWindow{ + Title: "WindowTest", + MinSize: Size{600, 400}, + Layout: VBox{}, + }.Run() -import ( - "github.com/lxn/walk" - . "github.com/lxn/walk/declarative" -) + ``` -func main() { - var aTextEdit *walk.TextEdit + A field for Children takes a slice of Widget structs (lxn base class for UI widgets) + Fields in widgets include AssignTo for data binding (Note the use of *pointer and &derefrence) - MainWindow{ - Title: "ChildrenTest", - MinSize: Size{600, 400}, - Layout: VBox{}, - Children: []Widget - { - TextEdit{AssignTo: &inTE}, - TextEdit{}, - }.Run() + ```go + package main -``` + import ( + "github.com/lxn/walk" + . "github.com/lxn/walk/declarative" + ) + + func main() { + var aTextEdit *walk.TextEdit + + MainWindow{ + Title: "ChildrenTest", + MinSize: Size{600, 400}, + Layout: VBox{}, + Children: []Widget + { + TextEdit{AssignTo: &inTE}, + TextEdit{}, + }.Run() + ``` ##### Create Manifest `test.manifest` From d952bc6d3a0fc0c32ea9b459cdb9ef0afaa26cf2 Mon Sep 17 00:00:00 2001 From: xphlawlessx Date: Tue, 6 Oct 2020 14:09:22 +0100 Subject: [PATCH 3/4] Updated -README.mdown I broke down the example to try and illustrate the component parts more clearly it's a start - Could do with lists of fields/ widgets , maybe a few more examples (EDIT) fixed a few formatting errors. --- README.mdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.mdown b/README.mdown index 4820fc5a4..e03e21c29 100644 --- a/README.mdown +++ b/README.mdown @@ -56,7 +56,7 @@ func main() { }, }.Run() } - +``` A slightly more detailed broken down example: ========== From a158fcbd9caff272cdee3942933eba7c093cc566 Mon Sep 17 00:00:00 2001 From: xphlawlessx Date: Tue, 6 Oct 2020 14:10:33 +0100 Subject: [PATCH 4/4] Updated -README.mdown I broke down the example to try and illustrate the component parts more clearly it's a start - Could do with lists of fields/ widgets , maybe a few more examples (EDIT) fixed a few formatting errors. --- README.mdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.mdown b/README.mdown index e03e21c29..21085a767 100644 --- a/README.mdown +++ b/README.mdown @@ -104,7 +104,7 @@ func main() { Layout: VBox{}, Children: []Widget { - TextEdit{AssignTo: &inTE}, + TextEdit{AssignTo: &aTextEdit}, TextEdit{}, }.Run()