Skip to content

Commit 1abba49

Browse files
committed
TableView: Fix ordering issue between SetScrollbarOrientation and SetHeaderHidden
Before this change, SetHeaderHidden needed to be called before SetScrollbarOrientation to work.
1 parent fe1f796 commit 1abba49

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

tableview.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,17 +1809,6 @@ func tableViewFrozenLVWndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr
18091809
func tableViewNormalLVWndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr {
18101810
tv := (*TableView)(unsafe.Pointer(windowFromHandle(win.GetParent(hwnd)).AsWindowBase()))
18111811

1812-
var off uint32 = win.WS_HSCROLL | win.WS_VSCROLL
1813-
if tv.scrollbarOrientation&Horizontal != 0 {
1814-
off &^= win.WS_HSCROLL
1815-
}
1816-
if tv.scrollbarOrientation&Vertical != 0 {
1817-
off &^= win.WS_VSCROLL
1818-
}
1819-
if off != 0 {
1820-
ensureWindowLongBits(hwnd, win.GWL_STYLE, off, false)
1821-
}
1822-
18231812
switch msg {
18241813
case win.WM_LBUTTONDOWN, win.WM_RBUTTONDOWN:
18251814
win.SetFocus(tv.hwndFrozenLV)
@@ -1834,7 +1823,20 @@ func tableViewNormalLVWndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr
18341823
tv.maybePublishFocusChanged(hwnd, msg, wp)
18351824
}
18361825

1837-
return tv.lvWndProc(tv.normalLVOrigWndProcPtr, hwnd, msg, wp, lp)
1826+
result := tv.lvWndProc(tv.normalLVOrigWndProcPtr, hwnd, msg, wp, lp)
1827+
1828+
var off uint32 = win.WS_HSCROLL | win.WS_VSCROLL
1829+
if tv.scrollbarOrientation&Horizontal != 0 {
1830+
off &^= win.WS_HSCROLL
1831+
}
1832+
if tv.scrollbarOrientation&Vertical != 0 {
1833+
off &^= win.WS_VSCROLL
1834+
}
1835+
if off != 0 {
1836+
ensureWindowLongBits(hwnd, win.GWL_STYLE, off, false)
1837+
}
1838+
1839+
return result
18381840
}
18391841

18401842
func (tv *TableView) lvWndProc(origWndProcPtr uintptr, hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr {

0 commit comments

Comments
 (0)