diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2015-10-15 10:12:59 +0200 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2015-10-15 10:12:59 +0200 |
commit | 5f1eb641e0248b8cc9cffcd24b96dbc94d4d6f97 (patch) | |
tree | c80d00ade3fa5bf252f55dee65425d89a549b207 /groupbox.go | |
parent | TableView: Add support for preventing sorting by header click (diff) | |
download | wireguard-windows-5f1eb641e0248b8cc9cffcd24b96dbc94d4d6f97.tar.xz wireguard-windows-5f1eb641e0248b8cc9cffcd24b96dbc94d4d6f97.zip |
GroupBox: Fix SetTitle having no visible effect, fixes #162, thanks CodyGuo for reporting
Diffstat (limited to 'groupbox.go')
-rw-r--r-- | groupbox.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/groupbox.go b/groupbox.go index 073e8d03..d3ff0b11 100644 --- a/groupbox.go +++ b/groupbox.go @@ -64,6 +64,7 @@ func NewGroupBox(parent Container) (*GroupBox, error) { return nil, err } + gb.SetCheckable(false) gb.checkBox.SetChecked(true) gb.checkBox.CheckedChanged().Attach(func() { @@ -220,6 +221,10 @@ func (gb *GroupBox) Title() string { func (gb *GroupBox) SetTitle(title string) error { if gb.Checkable() { + if err := setWindowText(gb.hWndGroupBox, ""); err != nil { + return err + } + return gb.checkBox.SetText(title) } @@ -230,8 +235,14 @@ func (gb *GroupBox) Checkable() bool { return gb.checkBox.visible } -func (gb *GroupBox) SetCheckable(visible bool) { - gb.checkBox.SetVisible(visible) +func (gb *GroupBox) SetCheckable(checkable bool) { + title := gb.Title() + + gb.checkBox.SetVisible(checkable) + + gb.SetTitle(title) + + gb.updateParentLayout() } func (gb *GroupBox) Checked() bool { @@ -256,6 +267,12 @@ func (gb *GroupBox) Children() *WidgetList { } func (gb *GroupBox) Layout() Layout { + if gb.composite == nil { + // Without this we would get into trouble through the call to + // SetCheckable in NewGroupBox. + return nil + } + return gb.composite.Layout() } |