Skip to content
A Windows GUI toolkit for the Go Programming Language
Go
Branch: master
Clone or download

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data Update README; add screenshots Feb 25, 2011
declarative Label: Add EllipsisMode Nov 21, 2019
examples Merge branch 'pending/dpi-fun2' of https://github.com/Amebis/walk int… Oct 23, 2019
l10n Update German translation Feb 5, 2018
tools/ui2walk Rename RootWidget to Form Jul 16, 2013
AUTHORS Added WindowGroup for management of state with thread affinity Sep 6, 2019
LICENSE Initial commit \o/ Sep 16, 2010
README.mdown Update README Aug 29, 2019
accessibility.go Accessibility: Fix error check Sep 27, 2019
action.go Initial DPI awareness support for images and drawing May 14, 2019
actionlist.go Replace ActionList.AttachShortcuts with WindowBase.ShortcutActions wh… Jun 19, 2019
application.go Increased reliance on WindowGroup for storage of data with thread aff… Sep 17, 2019
bitmap.go Make conversion constants float64 explicitly Sep 27, 2019
boxlayout.go boxLayoutFlags: Use union of child flags without modification Nov 27, 2019
brush.go DPI: Merge `SizePixels` to `Size` Sep 27, 2019
button.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
cancelevent.go *Event: Add Once method Nov 13, 2019
canvas.go Canvas: Fix GradientFillRectanglePixels orientation Oct 30, 2019
checkbox.go DPI: Merge `SizePixels` to `Size` Sep 27, 2019
clipboard.go global: don't do things in global init() Sep 4, 2019
closeevent.go *Event: Add Once method Nov 13, 2019
color.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
combobox.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
commondialogs.go commondialogs: do not generate new callback every browsefolder Sep 4, 2019
composite.go global: don't do things in global init() Sep 4, 2019
condition.go Use govaluate package to enable much more powerful expressions Feb 27, 2017
container.go global: don't do things in global init() Sep 4, 2019
cursor.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
customwidget.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
databinding.go Increased reliance on WindowGroup for storage of data with thread aff… Sep 17, 2019
dateedit.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
datelabel.go Labels: Let an embedded static control do the painting Dec 6, 2018
dialog.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
dropfilesevent.go *Event: Add Once method Nov 13, 2019
error.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
errorevent.go *Event: Add Once method Nov 13, 2019
event.go *Event: Add Once method Nov 13, 2019
expression.go reflectExpression: Return nil if value is invalid Dec 5, 2018
flowlayout.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
font.go Font: Use window instead of screen DPI Oct 7, 2019
fontresource.go Initial DPI awareness support for images and drawing May 14, 2019
form.go FormBase: Improve automatic resizing to accommodate children Nov 27, 2019
gradientcomposite.go DPI: Assume variable screen DPI and revise 96dpi functions Sep 26, 2019
graphicseffects.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
gridlayout.go Label: Add EllipsisMode Nov 21, 2019
groupbox.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
icon.go Icon: Switch to LoadIconWithScaleDown() Oct 31, 2019
iconcache.go DPI: Reorganize metrics structs to approach client compatibility Sep 26, 2019
image.go DPI, Image: Extend PaintFuncImage Oct 7, 2019
imagelist.go ImageList: Add DrawPixels Nov 6, 2019
imageview.go ImageView: Clean stale TODO annotation Oct 2, 2019
inifilesettings.go Replaced direct access to appSingleton with calls to App() Sep 17, 2019
intevent.go *Event: Add Once method Nov 13, 2019
intrangeevent.go *Event: Add Once method Nov 13, 2019
keyboard.go Add Alt+Ctrl to modifiers2string, thanks Stephan Verbeeck Mar 18, 2019
keyevent.go *Event: Add Once method Nov 13, 2019
label.go Label: Add EllipsisMode Nov 21, 2019
layout.go Attempt to focus a widget after layout to avoid glitches Nov 13, 2019
lineedit.go DPI: Cleanup Sep 27, 2019
linklabel.go DPI, Window: Rename min and maxSize because they are 1/96" Sep 27, 2019
listbox.go Font: Use window instead of screen DPI Oct 7, 2019
mainloop_cgo.go mainloop: fix commit that wasn't properly tested Sep 20, 2019
mainloop_default.go Increased reliance on WindowGroup for storage of data with thread aff… Sep 17, 2019
mainwindow.go DPI: Cleanup Sep 27, 2019
maptablemodel.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
menu.go DPI: Assume variable screen DPI and revise 96dpi functions Sep 26, 2019
messagebox.go messagebox: fix escape sequence May 22, 2019
metafile.go Metafile, DPI: Cleanup Oct 26, 2019
models.go Table[Model|View]: Add [Publish]RowsChanged for more efficient update… Oct 28, 2019
mouseevent.go *Event: Add Once method Nov 13, 2019
notifyicon.go DPI: Merge `Pixel` to `int` Sep 27, 2019
numberedit.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
numberlabel.go Labels: Let an embedded static control do the painting Dec 6, 2018
path.go Centralize retrieval of images from interface{} Sep 19, 2019
pen.go DPI: Replace "96dpi" name suffix by documenting expected parameters Sep 26, 2019
point.go DPI: Merge `PointPixels` to `Point` Sep 27, 2019
progressbar.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
progressindicator.go progressindicator: react to DPI changes May 16, 2019
property.go boolProperty: Accept source of type Expression Feb 25, 2019
pushbutton.go Run for your life or prepare to meet the Jul 17, 2019
radiobutton.go Run for your life or prepare to meet the Jul 17, 2019
rectangle.go DPI: Merge `RectangleGrid` to `Rectangle` Sep 27, 2019
reflectmodels.go reflectTableModel: Forward RowsChanged events Nov 13, 2019
registry.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
resourcemanager.go ResourceManager: Fix path in resource manager Sep 26, 2019
scrollview.go DPI: Deal with some TODOs Oct 23, 2019
separator.go DPI: Merge `SizePixels` to `Size` Sep 27, 2019
simpletypes.go Label reform Dec 5, 2018
size.go DPI, TabWidget: Revise adjustment calculating Oct 23, 2019
slider.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
spacer.go DPI: Merge `SizePixels` to `Size` Sep 27, 2019
splitbutton.go Run for your life or prepare to meet the Jul 17, 2019
splitter.go DPI: Merge `PointPixels` to `Point` Sep 27, 2019
splitterhandle.go DPI: Merge `SizePixels` to `Size` Sep 27, 2019
splitterlayout.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
static.go static: Use GET_[X|Y]_LPARAM to extract coordinates from LPARAM Nov 28, 2019
statusbar.go DPI: Cleanup Sep 27, 2019
stopwatch.go Unexport stopwatch stuff Aug 26, 2019
stringevent.go *Event: Add Once method Nov 13, 2019
tableview.go TableView: Display header tool tips for too narrow columns Nov 28, 2019
tableviewcolumn.go TableView: Fix StretchLastColumn regressions (again) Oct 30, 2019
tableviewcolumnlist.go TableView: Add support for frozen columns Mar 22, 2018
tabpage.go Centralize retrieval of images from interface{} Sep 19, 2019
tabpagelist.go Run for your life or prepare to meet the Jul 17, 2019
tabwidget.go tabWidgetLayoutItem: Make IdealSize the same as MinSize Nov 27, 2019
textedit.go TextEdit: Fix height when empty in compact height mode Oct 31, 2019
textlabel.go DPI: Merge `SizePixels` to `Size` Sep 27, 2019
toolbar.go ToolBar: Use ImageList.AddImage to avoid icon to bitmap conversion + … Oct 24, 2019
toolbutton.go DPI: Merge `SizeDBU` to `Size` Sep 27, 2019
tooltip.go TableView: Display header tool tips for too narrow columns Nov 28, 2019
tooltiperrorpresenter.go More GraphicsEffects changes Nov 21, 2017
treeitemevent.go *Event: Add Once method Nov 13, 2019
treeview.go TreeView: Enable performance improvements by not counting all children Oct 23, 2019
util.go Metafile, DPI: Cleanup Oct 26, 2019
validators.go No comment Oct 9, 2017
walk.go Button: Add Image property Feb 27, 2017
webview.go global: don't do things in global init() Sep 4, 2019
webview_dwebbrowserevents2.go global: don't do things in global init() Sep 4, 2019
webview_events.go (1)CommandStateChange event of DWebBrowser2.Invoke is splitted into 3… Apr 27, 2018
webview_idochostuihandler.go global: don't do things in global init() Sep 4, 2019
webview_ioleclientsite.go global: don't do things in global init() Sep 4, 2019
webview_ioleinplaceframe.go global: don't do things in global init() Sep 4, 2019
webview_ioleinplacesite.go global: don't do things in global init() Sep 4, 2019
widget.go DPI: Merge `RectanglePixels` to `Rectangle` Sep 27, 2019
widgetlist.go Improve performance of applying DPI change May 16, 2019
window.go Ensure synchronizing layout results of one form doesn't replace resul… Nov 4, 2019
windowgroup.go Ensure synchronizing layout results of one form doesn't replace resul… Nov 4, 2019

README.mdown

About Walk

Walk is a "Windows Application Library Kit" for the Go Programming Language.

Its primarily useful for Desktop GUI development, but there is some more stuff.

Setup

Make sure you have a working Go installation. See Getting Started

Note

Walk currently requires Go 1.11.x or later.

To Install

Now run go get github.com/lxn/walk

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
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()
}
Create Manifest test.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="SomeFunkyNameHere" type="win32"/>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
        </dependentAssembly>
    </dependency>
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
            <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
            <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
        </windowsSettings>
    </application>
</assembly>

Then either compile the manifest using the rsrc tool, like this:

go get github.com/akavel/rsrc
rsrc -manifest test.manifest -o rsrc.syso

or rename the test.manifest file to test.exe.manifest and distribute it with the application instead.

Build app

In the directory containing test.go run

go build

To get rid of the cmd window, instead run

go build -ldflags="-H windowsgui"
Run app
test.exe
Sample Output (Windows 7)

alt tag

More Examples

There are some examples that should get you started.

Application Manifest Files

Walk requires Common Controls 6. This means that you must put an appropriate application manifest file either next to your executable or embedded as a resource.

You can copy one of the application manifest files that come with the examples.

To embed a manifest file as a resource, you can use the rsrc tool.

IMPORTANT: If you don't embed a manifest as a resource, then you should not launch your executable before the manifest file is in place. If you do anyway, the program will not run properly. And worse, Windows will not recognize a manifest file, you later drop next to the executable. To fix this, rebuild your executable and only launch it with a manifest file in place.

CGo Optimizations

The usual default message loop includes calls to win32 API functions, which incurs a decent amount of runtime overhead coming from Go. As an alternative to this, you may compile Walk using an optional C implementation of the main message loop, by passing the walk_use_cgo build tag:

go build -tags walk_use_cgo

You can’t perform that action at this time.