walk Windows Application Library Kit

repository·master·Indexed 27 days ago

https://github.com/lxn/walk

A Windows Application Library Kit for the Go programming language designed for developing Desktop GUIs. It features a declarative sub package for defining UI structures and supports CGo message loop optimization to reduce Win32 API runtime overhead.

Tokens
645
Snippets
4
Records
6
Agent score
42%

What's inside walk

  1. Optimize Walk with CGo message loop

    master

    To reduce the runtime overhead caused by Go calling Win32 API functions in the default message loop, you can use an optional C implementation of the main message loop by using the walk_use_cgo build tag.

    go build -tags walk_use_cgo
  2. Create a GUI using the declarative sub package

    master

    The preferred way to build GUIs in Walk is using the github.com/lxn/walk/declarative sub package. This allows you to define your UI structure (Windows, Layouts, Widgets) using a declarative syntax.

    package main
    
    import (
    	"github.com/lxn/walk"
    	. "github.com/lxn/walk/declarative"
    	"strings"
    )
    
    func main() {
    	var inTE, outTE *walk.TextEdit
    	MainWindow{
    		Title:   "SCREAMO",
    		MinSize: Size{600, 400},
    		Layout:  VBox{},
    		Children: []Widget{
    			HSplitter{
    				Children: []Widget{
    					TextEdit{AssignTo: &inTE},
    						TextEdit{AssignTo: &outTE, ReadOnly: true},
    				},
    			},
    			PushButton{
    				Text: "SCREAM",
    				OnClicked: func() {
    					outTE.SetText(strings.ToUpper(inTE.Text()))
    				},
    			},
    		},
    	}.Run()
    }
  3. Configure Application Manifest Files

    master

    Walk requires Windows Common Controls 6. You must provide an application manifest file either by embedding it as a resource or placing it next to your executable.

    Warning: If you do not embed the manifest, do not launch the executable before the manifest file is in place, or the program will not run properly and Windows may fail to recognize the manifest later. If this happens, rebuild the executable with the manifest already present.