lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.84k stars 884 forks source link

Labels and mouse events #631

Closed errz99 closed 4 years ago

errz99 commented 4 years ago

Hi, Very simple thing so I must be loosing something: Mouse events on labels don't work for me.

Any idea? Thanks.

`package main

import( "fmt"

"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"

)

func main() {

MainWindow{
    Title: "Mouse Event Test",
    Layout: VBox{},
    Children: []Widget{
        TextLabel{
            Text: "Hello World!",
            OnMouseDown: func(x, i int, button walk.MouseButton) {
                fmt.Println("Mouse Down on Label") // seems not to work
            },
        },
        TextEdit{
            OnMouseDown: func(x, i int, button walk.MouseButton) {
                fmt.Println("Mouse Down on TextEdit")
            },
        },
        PushButton{
            Text: "Quit",
            OnClicked: func() {
                walk.App().Exit(0)
            },
        },
    },
}.Run()

} `