Go
Switch branches/tags
Nothing to show
Clone or download
lxn Merge pull request #388 from adongy/patch-1
Fix grid layout rectangle bounds check
Latest commit 02935ba May 21, 2018
Permalink
Failed to load latest commit information.
data Update README; add screenshots Feb 25, 2011
declarative (1)CommandStateChange event of DWebBrowser2.Invoke is splitted into 3… Apr 27, 2018
examples (1)CommandStateChange event of DWebBrowser2.Invoke is splitted into 3… Apr 27, 2018
l10n Update German translation Feb 5, 2018
tools/ui2walk Rename RootWidget to Form Jul 16, 2013
AUTHORS - declarative/webview.go : The fields are sorted alphabetically. Apr 15, 2018
LICENSE Initial commit \o/ Sep 16, 2010
README.mdown Replace existing manifest in the README with DPI-aware one Apr 18, 2018
action.go Action: Don't rely on conditions in Enabled and Visible, which could … Feb 9, 2017
actionlist.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
application.go Add ToolTipErrorPresenter Apr 11, 2017
bitmap.go WindowBase: Expose getState as ReadState and putState as WriteState Dec 12, 2017
boxlayout.go Merge branch 'master' into graphicseffects Nov 6, 2017
brush.go GradientBrush: Don't rely on SizeChanged for initial delegate Aug 29, 2017
button.go Cache widget text size calculation results to speed up layout Apr 23, 2018
cancelevent.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
canvas.go Canvas: Add DrawBitmapPart Nov 20, 2017
checkbox.go Cache widget text size calculation results to speed up layout Apr 23, 2018
clipboard.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
closeevent.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
color.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
combobox.go Cache widget text size calculation results to speed up layout Apr 23, 2018
commondialogs.go Add ShowReadOnlyCB boolean flag to walk.FileDialog Sep 25, 2017
composite.go Expose NewCompositeWithStyle Apr 11, 2017
condition.go Use govaluate package to enable much more powerful expressions Feb 27, 2017
container.go More GraphicsEffects changes Nov 21, 2017
cursor.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
customwidget.go add screenshot api Mar 13, 2016
databinding.go DataBinder: Add AutoSubmitSuspended Apr 23, 2018
dateedit.go DateEdit: Avoid false changed events Feb 5, 2018
dialog.go Fix glitch where the initially focused LineEdit would scroll part of … Apr 11, 2017
dropfilesevent.go Dropfiles: call DragAcceptFiles only once Dec 7, 2015
error.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
errorevent.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
event.go Fix layout scheduling problem that seems to occur for widgets w/o form Sep 28, 2017
expression.go Use a version of govaluate we are compatible with, fixes #291 Jul 10, 2017
font.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
form.go I modified to use walkDescendants to find WebViews Apr 29, 2018
gradientcomposite.go declarative/[Gradient]Composite: Add Border option Sep 25, 2017
graphicseffects.go More GraphicsEffects changes Nov 21, 2017
gridlayout.go Fix grid layout rectangle bounds check May 13, 2018
groupbox.go More GraphicsEffects changes Nov 21, 2017
icon.go make it possible to create an icon from an existing HICON May 12, 2017
image.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
imagelist.go Fix image list creation regression Feb 28, 2017
imageview.go ImageView: Don't add drop shadow effect by default Nov 21, 2017
inifilesettings.go IniFileSettings: Add portable parameter to save in cwd Mar 21, 2017
intevent.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
intrangeevent.go TableModel/TableView: Add support for adding and removing ranges of i… Feb 27, 2017
keyboard.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
keyevent.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
label.go Add GrowableHorz to Label to allow aligning May 21, 2018
lineedit.go Cache widget text size calculation results to speed up layout Apr 23, 2018
lineerrorpresenter.go Expose NewCompositeWithStyle Apr 11, 2017
linklabel.go Cache widget text size calculation results to speed up layout Apr 23, 2018
listbox.go More GraphicsEffects changes Nov 21, 2017
mainwindow.go add NewMainWindowWithName(); ensure name is passed to CreateWindowEx Oct 31, 2017
maptablemodel.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
menu.go MainWindow, Menu: Fix menu bar not being redrawn when inserting or re… Jan 11, 2016
messagebox.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
metafile.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
models.go TableView: Add support for cell owner drawing Nov 29, 2017
mouseevent.go To add the mouse wheel event processing for WindowBase Nov 23, 2015
notifyicon.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
numberedit.go More GraphicsEffects changes Nov 21, 2017
path.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
pen.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
point.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
progressbar.go More GraphicsEffects changes Nov 21, 2017
progressindicator.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
property.go Use govaluate package to enable much more powerful expressions Feb 27, 2017
pushbutton.go More GraphicsEffects changes Nov 21, 2017
radiobutton.go Cache widget text size calculation results to speed up layout Apr 23, 2018
rectangle.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
reflectmodels.go Add support for interfaces as items of reflection based models Feb 5, 2018
registry.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
resourcemanager.go Fix loading bitmap from resource Mar 9, 2017
scrollview.go More GraphicsEffects changes Nov 21, 2017
separator.go Add Separator widget Mar 23, 2017
simpletypes.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
size.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
slider.go WindowBase: Expose getState as ReadState and putState as WriteState Dec 12, 2017
spacer.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
splitbutton.go More GraphicsEffects changes Nov 21, 2017
splitter.go Splitter: Ensure widgets have a non-zero size when setting them to be… Feb 5, 2018
splitterhandle.go More GraphicsEffects changes Nov 21, 2017
splitterlayout.go Splitter: Fix layout with focus effects Apr 20, 2017
statusbar.go handle statusbar click events Apr 5, 2017
stringevent.go rename: OnTitleChanged -> OnDocumentTitleChanged Apr 16, 2018
tableview.go TableView: Fix off-by-one error in VisibleColumnsInDisplayOrder May 2, 2018
tableviewcolumn.go TableView: Add support for custom header and item heights + header cu… Apr 23, 2018
tableviewcolumnlist.go TableView: Add support for frozen columns Mar 22, 2018
tabpage.go More GraphicsEffects changes Nov 21, 2017
tabpagelist.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
tabwidget.go WindowBase: Expose getState as ReadState and putState as WriteState Dec 12, 2017
textedit.go Cache widget text size calculation results to speed up layout Apr 23, 2018
toolbar.go ToolBar: Invalidate on some events Apr 11, 2017
toolbutton.go More GraphicsEffects changes Nov 21, 2017
tooltip.go Add right to left support Aug 17, 2017
tooltiperrorpresenter.go More GraphicsEffects changes Nov 21, 2017
treeitemevent.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
treeview.go TreeView: Only retrieve text if the item is visible Feb 5, 2018
util.go Some layout improvements Mar 23, 2017
validators.go No comment Oct 9, 2017
walk.go Button: Add Image property Feb 27, 2017
webview.go (1)CommandStateChange event of DWebBrowser2.Invoke is splitted into 3… Apr 27, 2018
webview_dwebbrowserevents2.go (1)CommandStateChange event of DWebBrowser2.Invoke is splitted into 3… Apr 27, 2018
webview_events.go (1)CommandStateChange event of DWebBrowser2.Invoke is splitted into 3… Apr 27, 2018
webview_idochostuihandler.go - declarative/webview.go : The fields are sorted alphabetically. Apr 15, 2018
webview_ioleclientsite.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
webview_ioleinplaceframe.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
webview_ioleinplacesite.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
widget.go More GraphicsEffects changes Nov 21, 2017
widgetlist.go Add build tags to allow this library to be included in a cross platfo… Sep 15, 2015
window.go Cache widget text size calculation results to speed up layout Apr 23, 2018

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

Go 1.7.x doesn't work with walk anymore, Make sure you use Go 1.8.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" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <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>
    <asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3: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.

Program Crashes

By default Go uses os threads with small stack sizes of 128KB. If your walk app crashes, it may be due to a stack overflow. Until a better solution is found, you can work around this by adding

import _ "runtime/cgo"

somewhere in your program. If you don't have gcc installed and on your PATH, you can alternatively add -linkmode internal to the -ldflags of your go build command like so:

go build -ldflags="-H windowsgui -linkmode internal"