Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Readme #727

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -59,6 +58,59 @@ func main() {
}
```

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: &aTextEdit},
TextEdit{},
}.Run()

```


##### Create Manifest `test.manifest`

```xml
Expand Down