lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.8k stars 885 forks source link

`PushButton` unexpected behavior in `HSplitter` #663

Open dreamer2q opened 4 years ago

dreamer2q commented 4 years ago
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},
        Size:    Size{800, 600},
        Layout:  VBox{},
        Children: []Widget{
            HSplitter{
                Children: []Widget{
                    TextEdit{AssignTo: &inTE},
                    TextEdit{AssignTo: &outTE, ReadOnly: true},
                },
            },
            HSplitter{
                Children: []Widget{
                    PushButton{
                        Text:     "SCREAM",
                        OnClicked: func() {
                            outTE.SetText(strings.ToUpper(inTE.Text()))
                        },
                    },
                    PushButton{
                        Text: "TestButton",
                        OnClicked: func() {
                            walk.MsgBox(nil, "Title", inTE.Text(), walk.MsgBoxOK)
                        },
                    },
                },
            },
        },
    }.Run()
}

Sorry to trouble, I am just a new beginner using walk

I followed steps in README and it worked perfectly.

After that, I add a HSplitter with 2 PushButtons from README test.go

But, when I enlarge the window and resize it back, the PushButton in HSplitter didn't behavior as I expected to resize to its previous size.

So, what's the problem or it's just a feature?

dreamer2q commented 4 years ago

Normal and Startup Behavior

normal

Unexpected Behavior

unexpected

lxn commented 3 years ago

Looks like this is working now.