Skip to content

Commit 45de27c

Browse files
committed
TableView: Simplify SetHeaderHidden
1 parent 1abba49 commit 45de27c

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

tableview.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -561,27 +561,11 @@ func (tv *TableView) HeaderHidden() bool {
561561

562562
// SetHeaderHidden sets whether the column header is hidden.
563563
func (tv *TableView) SetHeaderHidden(hidden bool) error {
564-
updateStyle := func(hwnd win.HWND) error {
565-
style := win.GetWindowLong(hwnd, win.GWL_STYLE)
566-
567-
if hidden {
568-
style |= win.LVS_NOCOLUMNHEADER
569-
} else {
570-
style &^= win.LVS_NOCOLUMNHEADER
571-
}
572-
573-
if 0 == win.SetWindowLong(hwnd, win.GWL_STYLE, style) {
574-
return lastError("SetWindowLong(GWL_STYLE)")
575-
}
576-
577-
return nil
578-
}
579-
580-
if err := updateStyle(tv.hwndFrozenLV); err != nil {
564+
if err := ensureWindowLongBits(tv.hwndFrozenLV, win.GWL_STYLE, win.LVS_NOCOLUMNHEADER, hidden); err != nil {
581565
return err
582566
}
583567

584-
return updateStyle(tv.hwndNormalLV)
568+
return ensureWindowLongBits(tv.hwndNormalLV, win.GWL_STYLE, win.LVS_NOCOLUMNHEADER, hidden)
585569
}
586570

587571
// AlternatingRowBG returns the alternating row background.

0 commit comments

Comments
 (0)