diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2020-08-31 17:39:30 +0200 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2020-08-31 17:39:30 +0200 |
commit | 873cfd79d5b38cda866cb2b33e656464242ba420 (patch) | |
tree | 47e6620c3c3f4c940828fe694c6a7964b5404efd | |
parent | ListBox: Add data binding support (diff) | |
download | wireguard-windows-873cfd79d5b38cda866cb2b33e656464242ba420.tar.xz wireguard-windows-873cfd79d5b38cda866cb2b33e656464242ba420.zip |
TableView: Reduce flicker
-rw-r--r-- | tableview.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tableview.go b/tableview.go index 6d47e712..25928b8b 100644 --- a/tableview.go +++ b/tableview.go @@ -933,10 +933,10 @@ func (tv *TableView) setItemCount() error { count = tv.model.RowCount() } - if 0 == win.SendMessage(tv.hwndFrozenLV, win.LVM_SETITEMCOUNT, uintptr(count), win.LVSICF_NOSCROLL) { + if 0 == win.SendMessage(tv.hwndFrozenLV, win.LVM_SETITEMCOUNT, uintptr(count), win.LVSICF_NOINVALIDATEALL|win.LVSICF_NOSCROLL) { return newError("SendMessage(LVM_SETITEMCOUNT)") } - if 0 == win.SendMessage(tv.hwndNormalLV, win.LVM_SETITEMCOUNT, uintptr(count), win.LVSICF_NOSCROLL) { + if 0 == win.SendMessage(tv.hwndNormalLV, win.LVM_SETITEMCOUNT, uintptr(count), win.LVSICF_NOINVALIDATEALL|win.LVSICF_NOSCROLL) { return newError("SendMessage(LVM_SETITEMCOUNT)") } @@ -1896,9 +1896,10 @@ func (tv *TableView) maybePublishFocusChanged(hwnd win.HWND, msg uint32, wp uint func tableViewFrozenLVWndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr { tv := (*TableView)(unsafe.Pointer(windowFromHandle(win.GetParent(hwnd)).AsWindowBase())) - ensureWindowLongBits(hwnd, win.GWL_STYLE, win.WS_HSCROLL|win.WS_VSCROLL, false) - switch msg { + case win.WM_NCCALCSIZE: + ensureWindowLongBits(hwnd, win.GWL_STYLE, win.WS_HSCROLL|win.WS_VSCROLL, false) + case win.WM_SETFOCUS: win.SetFocus(tv.hwndNormalLV) tv.maybePublishFocusChanged(hwnd, msg, wp) |