Giter VIP home page Giter VIP logo

walk's Introduction

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

walk's People

Contributors

adongy avatar akavel avatar bsiegert avatar ccherng avatar daanzu avatar dfbag7 avatar evangwt avatar iquanxin avatar joshuasjoding avatar jscholes avatar jtwatson avatar jwatson-gcu avatar knieriem avatar ktye avatar llxwj avatar lxn avatar olekukonko avatar pwolf23 avatar regentag avatar rozmansi avatar ryujimiya avatar shivas avatar tajtiattila avatar timdufrane avatar tmm1 avatar vanackere avatar xoviat avatar zhubicen avatar zobzn avatar zx2c4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

walk's Issues

Example applications fail to run

When running any of the examples, I get:

panic: syscall.LoadLibrary("comctl32.dll") failed: %1 is not a valid Win32 application.

I built walk using 6g version weekly.2011-10-18 10125 from inside MSYS (MinGW) and gomake. Is this an issue due to using the 64-bit compiler instead of 32-bit?

can setAndClearStyleBits func be public?

first, i am sorry for my poor english
in mainwindow.go file, if i want to do some frameless window, i will use setAndClearStyleBits func, but it is private, does author will public this func, or there is some method for this that i do not found.

Event function handling needs to be redone for Go 1

In Go 1 (and at tip right now), it is illegal to compare function pointers against one another. Only comparisons against nil are allowed. In cancelevent.go (and the others!), Detach no longer compiles:

func (e *CancelEvent) Detach(handler CancelEventHandler) {
    for i, h := range e.handlers {
        if h == handler {
            e.handlers = append(e.handlers[:i], e.handlers[i+1:]...)
            return
        }
    }
}

You can no longer do the h == handler comparison.

Proposal for a changed interface: return a handle which is equal to the index of the function. Make Detach take (index int) and do e.handlers[index] = nil. In Publish, call the function only if non-nil.

Ideally, there would be a common signature for the different kinds of handler functions and only one Event type with different instances ...

syscall.UTF16 undefined during installation

I get the following during installation

go get github.com/lxn/walk
# github.com/lxn/walk
C:\run\go\src\pkg\github.com\lxn\walk\clipboard.go:101: undefined: syscall.UTF16
FromString
C:\run\go\src\pkg\github.com\lxn\walk\inifilesettings.go:141: undefined: bufio.N
ewScanner
C:\run\go\src\pkg\github.com\lxn\walk\numberedit.go:148: undefined: syscall.UTF1
6FromString
C:\run\go\src\pkg\github.com\lxn\walk\numberedit.go:171: undefined: syscall.UTF1
6FromString
C:\run\go\src\pkg\github.com\lxn\walk\statusbar.go:136: method sbi.updateIcon is
 not an expression, must be called
C:\run\go\src\pkg\github.com\lxn\walk\statusbar.go:153: method sbi.updateText is
 not an expression, must be called
C:\run\go\src\pkg\github.com\lxn\walk\statusbar.go:170: method sbi.updateToolTip
Text is not an expression, must be called
C:\run\go\src\pkg\github.com\lxn\walk\statusbar.go:256: undefined: syscall.UTF16
PtrFromString
C:\run\go\src\pkg\github.com\lxn\walk\statusbar.go:273: undefined: syscall.UTF16
PtrFromString
  • System : Windows 7 66 bit
  • Version : go 1.0.3

Is there any simulated events API ?

I want to simulate some mouse events like winAPI mouse_event() or keybd_event()

but,i haven't find it in walk pkg

so,i post this issue for answer

listbox.go undefined constants

C:\Users\sony>go get github.com/lxn/walk
C:\Go\src\pkg\github.com\lxn\walk\listbox.go:39: undefined: LBS_STANDARD
C:\Go\src\pkg\github.com\lxn\walk\listbox.go:82: undefined: LB_ERRSPACE
C:\Go\src\pkg\github.com\lxn\walk\listbox.go:82: undefined: LB_ERR
C:\Go\src\pkg\github.com\lxn\walk\listbox.go:232: undefined: LB_ERR

unsafe.Sizeof now returns uintptr

In tip, unsafe.Sizeof has been changed to return uintptr. This causes a variety of issues during the build of walk:

bitmap.go:32: cannot use 84 (type uintptr) as type int in function argument
bitmap.go:65: cannot use 84 (type uintptr) as type int in function argument
document.go:241: cannot use 20 (type uintptr) as type int in assignment
printerinfo.go:213: invalid operation: 8 + (driverLen + printerLen + portLen) * 2 (mismatched types uintptr and int)
printerinfo.go:288: invalid operation: index * 2 (mismatched types int and uintptr)

I can try to send a patch if you like.

How to run examples?

go run notifyicon.go
2013/07/26 16:39:19 TTM_ADDTOOL failed

Stack:
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/error.go:79 (0x42ba2f)
        com/lxn/walk.newErr: return &Error{message: message, stack: debug.Stack()}
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/error.go:83 (0x42bb22)
        com/lxn/walk.newError: return processError(newErr(message))
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/tooltip.go:115 (0x43ea31)
        com/lxn/walk.(*ToolTip).AddTool: return newError("TTM_ADDTOOL failed")
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/widget.go:110 (0x44229d)
        com/lxn/walk.(*WidgetBase).init: if err := globalToolTip.AddTool(wb); err != nil {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/window.go:386 (0x4447e0)
        com/lxn/walk.InitWindow: if err := wb.init(widget); err != nil {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/widget.go:86 (0x442057)
        com/lxn/walk.InitWidget: if err := InitWindow(widget, parent, className, style|win.WS_CHILD, exStyle); err != ni
l {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/composite.go:32 (0x428b8e)
        com/lxn/walk.newCompositeWithStyle: win.WS_EX_CONTROLPARENT); err != nil {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/composite.go:40 (0x428cdb)
        com/lxn/walk.NewComposite: return newCompositeWithStyle(parent, 0)
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/form.go:81 (0x42ce66)
        com/lxn/walk.(*FormBase).init: if fb.clientComposite, err = NewComposite(form); err != nil {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/window.go:402 (0x444924)
        com/lxn/walk.InitWindow: if err := fb.init(form); err != nil {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/mainwindow.go:37 (0x4302cc)
        com/lxn/walk.NewMainWindow: win.WS_EX_CONTROLPARENT); err != nil {
d:/Users/Cyrus/gofiles/src/github.com/lxn/walk/examples/notifyicon/notifyicon.go:18 (0x40102a)
        main: mw, err := walk.NewMainWindow()
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist417694871/go/src/pkg/runtime/proc.c:182 (0x4148e9)
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist417694871/go/src/pkg/runtime/proc.c:1223 (0x416a40)
exit status 1

ComboBox KeyDown not workable

I've tried combobox.KeyDown().Attach(fun) and combobox.BaseWidget().KeyDown().Attach(fun), but neither would work. So what's wrong?

semi one way data binding of walk?

The DataBinder has a Submit method to extract data from the GUI to the underlying data source. But it seems that the data source is only loaded once at the very first binding initialization period and no way to load the data source anymore, isn't it?

Since WALK supports the Property mechanism, would it be fantastic to have double way bindings?

Locale setting causes panic on startup

If the locale's "No. of digits after decimal" is set to 0 (Region & Language > Additional Settings), all of the example binaries (and presumably all other walk binaries) panic on startup:

panic: runtime error: index out of range

goroutine 1 [running]:
github.com/lxn/walk.init()
    D:/lang/gopath/src/github.com/lxn/walk/util.go:47 +0x18f

The problem goes away if the setting is changed or by monkeypatching values for decimalSetB etc. in util.go.

This is on en_GB; I'm not sure if this is the default for this or any locale, but I can't remember setting it myself (although that's often the case with mysteriously broken things on Windows).

WidgetList is not iterable

Inside the walk code, WidgetLists are iterated over by accessing the items slice directly so that you can range over them. It would be nice if you could just use range over the WidgetList itself, since currently you have to go through a container's children the "hard" way.

how to use predefined icons?

I know walk.NewIconFromResource(res string),
but I just want use IDI_APPLICATION predefined icon with NotifyIcon

Impossible Errors

When I "go get github.com/lxn/walk",So many errors prevented me from building the package as following:
"
E:\go\workspace\src\github.com\lxn\walk\clipboard.go:101: undefined: syscall.UT
16FromString
E:\go\workspace\src\github.com\lxn\walk\inifilesettings.go:141: undefined: bufi
.NewScanner
E:\go\workspace\src\github.com\lxn\walk\numberedit.go:148: undefined: syscall.U
F16FromString
E:\go\workspace\src\github.com\lxn\walk\numberedit.go:171: undefined: syscall.U
F16FromString
E:\go\workspace\src\github.com\lxn\walk\statusbar.go:136: method sbi.updateIcon
is not an expression, must be called
E:\go\workspace\src\github.com\lxn\walk\statusbar.go:153: method sbi.updateText
is not an expression, must be called
E:\go\workspace\src\github.com\lxn\walk\statusbar.go:170: method sbi.updateTool
ipText is not an expression, must be called
E:\go\workspace\src\github.com\lxn\walk\statusbar.go:256: undefined: syscall.UT
16PtrFromString
E:\go\workspace\src\github.com\lxn\walk\statusbar.go:273: undefined: syscall.UT
16PtrFromString
"
I do think it is an impossible accident which really happend.Would u please tell me WHY?

Fail to install Walk for Go

Does walk fo go only work well in Windows?My OS is Mac, I can't install walk and the errors is showed behind.

$ go get github.com/lxn/walk

github.com/lxn/go-winapi
Documents/Go/mypkg/src/github.com/lxn/go-winapi/advapi32.go:80: too many arguments in call to syscall.Syscall
Documents/Go/mypkg/src/github.com/lxn/go-winapi/advapi32.go:93: too many arguments in call to syscall.Syscall6
Documents/Go/mypkg/src/github.com/lxn/go-winapi/advapi32.go:105: too many arguments in call to syscall.Syscall6
Documents/Go/mypkg/src/github.com/lxn/go-winapi/advapi32.go:112: undefined: syscall.Syscall9
Documents/Go/mypkg/src/github.com/lxn/go-winapi/advapi32.go:131: too many arguments in call to syscall.Syscall6
Documents/Go/mypkg/src/github.com/lxn/go-winapi/comctl32.go:206: too many arguments in call to syscall.Syscall
Documents/Go/mypkg/src/github.com/lxn/go-winapi/comctl32.go:215: too many arguments in call to syscall.Syscall
Documents/Go/mypkg/src/github.com/lxn/go-winapi/comctl32.go:227: too many arguments in call to syscall.Syscall6
Documents/Go/mypkg/src/github.com/lxn/go-winapi/comctl32.go:235: too many arguments in call to syscall.Syscall
Documents/Go/mypkg/src/github.com/lxn/go-winapi/comctl32.go:245: too many arguments in call to syscall.Syscall
Documents/Go/mypkg/src/github.com/lxn/go-winapi/comctl32.go:245: too many errors

TableView no SetCloums?

i am use *.ui create TableView,but i not found SetCloums,so,don't change Cloums?how can change it?

Webview Example Crashing

I'm new to Go, so I'm not too sure how this issue is happening.

When attempting to run the Webview example, I get a crash after the HTML page loads:

Faulting application name: walk-web.exe, version: 0.0.0.0, time stamp: 0x4f750a0a
Faulting module name: walk-web.exe, version: 0.0.0.0, time stamp: 0x4f750a0a
Exception code: 0x80000003
Fault offset: 0x00000000000197b7
Faulting process id: 0x16e4
Faulting application start time: 0x01cd0e159a0ba747
Faulting application path: C:\Users\dmuso\Documents\Code\Go\1\examples\walk-web\walk-web.exe
Faulting module path: C:\Users\dmuso\Documents\Code\Go\1\examples\walk-web\walk-web.exe
Report Id: d9c0a249-7a08-11e1-9bef-180373d18cf0

There isn't any stack trace or debugging information here, and I'm not too sure how I can get that out. I'm happy to do some more investigation if it helps.

I can successfully build and use the imageviewer example, so my install of Go and Walk seem to be working properly.

My environment is:
Windows 7 x64, Go1

If I comment out loading a URL in the code, the window and webview control will load and not crash, so this only seems to be triggered when loading a website within the webview control.

It will also crash if after the window loads without a URL, I type one in the text field and hit enter.

Nothing happend

When I use go build with the example , it just produce a executable file, when I run it, nothing happened, no error infos and no window display.

forgive my pool english .

what's wrong? I install the latest walk package and go 1.0.3

Use of uint and int

Because the size of uint and int aren't specified in the go-spec (they could be either 32 or 64 bit), and the size of int is specified for the Windows API to be 32 bit, I would suggest using int32 and uint32 for the Windows structures.

walk.CheckBox: MinSizeHint: Should there be a compensation for the gap between icon and text?

It appears to me that the Text item of a CheckBox gets truncated, i.e. the
last few characters won't be displayed, as can be seen from the screenshot
made on Windows XP:

truncated

The source of the program can be found at http://play.golang.org/p/7dHkImdPLF.

I had a look at walk/checkbox.go:/MinSizeHint, where a minimum width is calculated
as the sum of the width of the checkbox icon and the width of the displayed text.
I wondered whether there should be a compensation for the little space between
the icon and the text, provided this compensation isn't already accounted for by
the GetSystemMetrics call. My naive approach to fix the problem was to add the extra
width of an 'n' to the textSize:

--- a/checkbox.go
+++ b/checkbox.go
@@ -33,7 +33,7 @@ func (*CheckBox) LayoutFlags() LayoutFlags {

 func (cb *CheckBox) MinSizeHint() Size {
    defaultSize := cb.dialogBaseUnitsToPixels(Size{50, 10})
-   textSize := cb.calculateTextSize()
+   textSize := cb.calculateTextSizeImpl("n"+widgetText(cb.hWnd))

    // FIXME: Use GetThemePartSize instead of GetSystemMetrics?
    w := textSize.Width + int(GetSystemMetrics(SM_CXMENUCHECK))

This change seems to fix the issue for me, at least on Windows XP (I don't have access
to newer versions of Windows).

Michael

PS: The additional HSpacer (still commented out) in the example program
is necessary to avoid the text of the first checkbox being clipped.

Any Webkit & Blink Plan

Is there any pans to include webkit or blink for web based desktop applications or this already exists ?

Varies compatibility issues

I tried varies examples on varies versions of Windows and ReactOS.

XP: all works perfectly.
7: crashes on certain commands.
ReactOS: file browser worked but everything else crashed.

These were all built from source. I tried using the apps built with 7 on XP and ReactOS and all gave an error.

how to remove the Console Window?

It is a little pity that there is always a CONSOLE window on the screen .How Can I remove it ?
When I build it by "-ldflags -Hwindowsgui",It returns "unknown flag -Hwindowsgui"
AS FOLLOWING:
E:\go\workspace\src\DQPS>go build -ldflags -Hwindowsgui

DQPS
E:\GO\GO\pkg\tool\windows_386\8l.exe: unknown flag -Hwindowsgui

widget placement issue concerning Qt Designer created UI

Using the Qt4 Designer on Linux, I naively created a small user interface consisting of a MainWindow and a push button. The MainWindow automatically contains a Composite named centralwidget. Inside this composite is a push button:

MainWindow of example UI in the Qt Designer

When run, the contents of the application window seems to have an offset, and it is cut somewhere near the middle of the window:

MainWindow of running application

The result is the same for Windows XP 32-bit, and Wine on Linux.

If I insert the lines

w.ui.centralwidget.SetX(0)
w.ui.centralwidget.SetY(0)
w.ui.centralwidget.SetClientSize(walk.Size{800,600})

into example_ui.go after the call w.ui.centralwidget.SetName("centralwidget"), the application window looks right.
It appears to be something wrong with the placement of the centralwidget composite.
Though, even then, if I modify the window's size using the mouse, the push button immediately
snaps back into the old position in the middle of the screen, as shown in the second screenshot.

Is there something the ui2walk tool could do about it? Or, am i missing something, like embedding
layout elements in a certain way to get to the expected behaviour?

The example.ui file and a main.go is available at http://wmipf.de/walk-exampleui/exampleui.zip.

Thanks, Michael

Titlebar buttons flickering

Under Windows 7 and Aero interface.

When mouse is over these buttons, they start to flicker multiple times per second: selected - unselected - selected - etc.

It happens only if aero is enabled.

LineEdit initialization fails using declarative interface

Attempting to use the declarative interface to Create() a LineEdit widget causes an error with the message "EM_SETCUEBANNER failed". As the title may suggest, it's still possible to initialize a LineEdit widget using the standard imperative interface.

StackTrace

C:/Go/src/pkg/github.com/lxn/walk/error.go:77 (0x42ec1f)
        com/lxn/walk.newErr: return &Error{message: message, stack: debug.Stack()}
C:/Go/src/pkg/github.com/lxn/walk/error.go:81 (0x42ecf3)
        com/lxn/walk.newError: return processError(newErr(message))
C:/Go/src/pkg/github.com/lxn/walk/lineedit.go:83 (0x4339f8)
        com/lxn/walk.(*LineEdit).SetCueBanner: return newError("EM_SETCUEBANNER failed")
C:/Go/src/pkg/github.com/lxn/walk/declarative/lineedit.go:48 (0x44a680)
        com/lxn/walk/declarative._func_010: if err := w.SetCueBanner(le.CueBanner); err != nil {
C:/Go/src/pkg/github.com/lxn/walk/declarative/util.go:104 (0x44a39c)
        com/lxn/walk/declarative.InitWidget: if err := customInit(); err != nil {
C:/Go/src/pkg/github.com/lxn/walk/declarative/lineedit.go:69 (0x4495a4)
        com/lxn/walk/declarative.LineEdit.Create: })
D:/Development/go/gowalk-test/linetest.go:21 (0x401297)
        main: if err := (dec.LineEdit{AssignTo: &le, Text: "Woot"}).Create(mw); nil != err {
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/runtime/proc.c:244 (0x40e03b)
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist767862039/go/src/pkg/runtime/proc.c:271 (0x40e0e4)

Example Source

Compiled and run on Windows 8 64-bit Consumer Preview (build 8400).

package main

import (
    "fmt"
    "github.com/lxn/walk"
    dec "github.com/lxn/walk/declarative"
    "os"
)

func ErrorAndExit(err error) {
    fmt.Fprintln(os.Stderr, err.Error())
    os.Exit(1)
}

func main() {
    var mw *walk.MainWindow
    if err := (dec.MainWindow{AssignTo: &mw, Title: "LineEdit Test", Layout: dec.VBox{}}.Create()); nil != err {
        ErrorAndExit(err)
    }
    var le *walk.LineEdit
    if err := (dec.LineEdit{AssignTo: &le, Text: "Woot"}).Create(mw); nil != err {
        ErrorAndExit(err)
    }
    mw.Children().Add(le)
    mw.Run()
}

Executable is path dependant

Moving a .exe file to a directory other than the one it was compiled in results in no execution. I'm using go version 1.0.3 on an amd64 machine running Vista Enterprise (yeah I know but its a box at work). If I compile the help file sources like this,

cd %GOPATH%\src\screamo
dir
screamo.go screamo.exe.manifest
go build screamo
dir
screamo.go screamo.exe.manifest screamo.exe

Running the executable (cmd line or double click) gives the familiar two panel window and bottom button.

However if I drag the executable or the executable and the manifest file to the desktop, double clicking results in a command window popping up and closing - similar to compiling and running w/o the manifest file.

walk.NewMainWindow failed with message "panic: TTM_ADDTOOL failed"

The goplay failed with this output when fed with the content of examples/drawing.go. But when doing: go run drawing.go , it's ok.

The other program i write using the ui2walk.exe generated ui files runs into this kind of panic again.

It seems there's something wrong with walk.InitWidget , is't right? How to fix it?

panic: TTM_ADDTOOL failed

Stack:
E:/repos/libs/gopkgs/src/github.com/lxn/walk/error.go:77 (0x4219b9)
    com/lxn/walk.newErr: return &Error{message: message, stack: debug.Stack()}
E:/repos/libs/gopkgs/src/github.com/lxn/walk/error.go:81 (0x421a50)
    com/lxn/walk.newError: return processError(newErr(message))
E:/repos/libs/gopkgs/src/github.com/lxn/walk/tooltip.go:113 (0x42b716)
    com/lxn/walk.(*ToolTip).AddTool: return newError("TTM_ADDTOOL failed")
E:/repos/libs/gopkgs/src/github.com/lxn/walk/widget.go:423 (0x4307fe)
    com/lxn/walk.InitWidget: if err := globalToolTip.AddTool(widget); err != nil {
E:/repos/libs/gopkgs/src/github.com/lxn/walk/mainwindow.go:30 (0x423b06)
    com/lxn/walk.NewMainWindow: WS_EX_CONTROLPARENT); err != nil {
C:/Documents and Settings/Administrator/Local Settings/Temp/compile11.go:82 (0x4017d1)
    main: mainWnd, _ := walk.NewMainWindow()
C:/Go/src/pkg/runtime/proc.c:244 (0x40f12a)
    main: main·main();
C:/Go/src/pkg/runtime/proc.c:271 (0x40f1c2)
    goexit: runtime·goexit(void)

Is there "Balloon ToolTip" for walk.NotifyIcon ?

Well, walk is a great work!
It's powerful though quite simple to use!
I want to know Is there "Balloon ToolTip" for walk.NotifyIcon; or how to add some(i'm not familiar with the Win32 API)?

panic: App().Settings() must not be nil

hi lxn, i found example
imageviewer
logview
have error:

  logview git:(master) ✗ go build
logview git:(master) ✗ ./logview
panic: App().Settings() must not be nil

Stack:
E:/code/go/src/github.com/lxn/walk/error.go:77 (0x43ec9f)
        com/lxn/walk.newErr: return &Error{message: message, stack: debug.Stack()}
E:/code/go/src/github.com/lxn/walk/error.go:81 (0x43ed92)
        com/lxn/walk.newError: return processError(newErr(message))
E:/code/go/src/github.com/lxn/walk/widget.go:1382 (0x457005)
        com/lxn/walk.(*WidgetBase).getState: return "", newError("App().Settings() must not be nil")
E:/code/go/src/github.com/lxn/walk/toplevelwindow.go:235 (0x44f61b)
        com/lxn/walk.(*TopLevelWindow).RestoreState: state, err := tlw.getState()
E:/code/go/src/github.com/lxn/walk/toplevelwindow.go:184 (0x44f108)
        com/lxn/walk.(*TopLevelWindow).Show: tlw.RestoreState()
E:/code/go/src/github.com/lxn/walk/examples/logview/logviewapp.go:33 (0x4017cb)
        main: myWindow.Show()
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist357622851/go/src/pkg/runtime/proc.c:182 (0x415299)
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist357622851/go/src/pkg/runtime/proc.c:1223 (0x4173f0)

Build error with version release.r58.1 8699

$ gomake
make -C pkg/walk/winapi          clean
make[1]: Entering directory `/d/Downloads/walk/src/pkg/walk/winapi'
rm -rf *.o *.a *.[568vq] [568vq].out *.so _obj _test _testmain.go *.exe _cgo* *.
cgo[12].* test.out build.out
make[1]: Leaving directory `/d/Downloads/walk/src/pkg/walk/winapi'
make -C pkg/walk                 clean
make[1]: Entering directory `/d/Downloads/walk/src/pkg/walk'
rm -rf *.o *.a *.[568vq] [568vq].out *.so _obj _test _testmain.go *.exe _cgo* *.
cgo[12].* test.out build.out
make[1]: Leaving directory `/d/Downloads/walk/src/pkg/walk'
make -C cmd/tools/ui2walk        clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/tools/ui2walk'
rm -rf *.o *.a *.[568vq] [568vq].out ui2walk.exe _test _testmain.go test.out bui
ld.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/tools/ui2walk'
make -C cmd/examples/drawing     clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/drawing'
rm -rf *.o *.a *.[568vq] [568vq].out drawing.exe _test _testmain.go test.out bui
ld.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/drawing'
make -C cmd/examples/filebrowser clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/filebrowser'
rm -rf *.o *.a *.[568vq] [568vq].out filebrowser.exe _test _testmain.go test.out
 build.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/filebrowser'
make -C cmd/examples/imageviewer clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/imageviewer'
rm -rf *.o *.a *.[568vq] [568vq].out imageviewer.exe _test _testmain.go test.out
 build.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/imageviewer'
make -C cmd/examples/notifyicon  clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/notifyicon'
rm -rf *.o *.a *.[568vq] [568vq].out notifyicon.exe _test _testmain.go test.out
build.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/notifyicon'
make -C cmd/examples/printing    clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/printing'
rm -rf *.o *.a *.[568vq] [568vq].out printing.exe _test _testmain.go test.out bu
ild.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/printing'
make -C cmd/examples/tableview   clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/tableview'
rm -rf *.o *.a *.[568vq] [568vq].out tableview.exe _test _testmain.go test.out b
uild.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/tableview'
make -C cmd/examples/webbrowser  clean
make[1]: Entering directory `/d/Downloads/walk/src/cmd/examples/webbrowser'
rm -rf *.o *.a *.[568vq] [568vq].out webbrowser.exe _test _testmain.go test.out
build.out
make[1]: Leaving directory `/d/Downloads/walk/src/cmd/examples/webbrowser'
make -C pkg/walk/winapi          install
make[1]: Entering directory `/d/Downloads/walk/src/pkg/walk/winapi'
8g  -o _go_.8 advapi32.go combobox.go comctl32.go comdlg32.go datetimepicker.go
edit.go gdi32.go gdiplus.go kernel32.go listview.go menu.go ole32.go oleaut32.go
 shdocvw.go shell32.go tab.go toolbar.go tooltip.go treeview.go updown.go user32
.go uxtheme.go winapi.go winspool.go
winapi.go:56: undefined: syscall.Handle
make[1]: *** [_go_.8] Error 1
make[1]: Leaving directory `/d/Downloads/walk/src/pkg/walk/winapi'
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.