diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-10-28 12:43:15 +0100 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-10-28 12:43:15 +0100 |
commit | e4edf856f3dbf0583137497f7dab032b734714df (patch) | |
tree | 81cee92a9b4c34f617c7063d29ca3c6c524adc7a | |
parent | Merge pull request #635 from zx2c4-forks/scrolltable (diff) | |
download | wireguard-windows-e4edf856f3dbf0583137497f7dab032b734714df.tar.xz wireguard-windows-e4edf856f3dbf0583137497f7dab032b734714df.zip |
TableView: Avoid flicker when updating items
-rw-r--r-- | tableview.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tableview.go b/tableview.go index b82f786f..7a8ce74e 100644 --- a/tableview.go +++ b/tableview.go @@ -680,7 +680,15 @@ func (tv *TableView) UpdateItem(index int) error { return err } - return tv.Invalidate() + first := win.SendMessage(tv.hwndNormalLV, win.LVM_GETTOPINDEX, 0, 0) + last := first + win.SendMessage(tv.hwndNormalLV, win.LVM_GETCOUNTPERPAGE, 0, 0) + 1 + + if win.FALSE == win.SendMessage(tv.hwndFrozenLV, win.LVM_REDRAWITEMS, first, last) { + return newError("LVM_REDRAWITEMS") + } + if win.FALSE == win.SendMessage(tv.hwndNormalLV, win.LVM_REDRAWITEMS, first, last) { + return newError("LVM_REDRAWITEMS") + } } else { if win.FALSE == win.SendMessage(tv.hwndFrozenLV, win.LVM_UPDATE, uintptr(index), 0) { return newError("LVM_UPDATE") @@ -744,7 +752,6 @@ func (tv *TableView) attachModel() { tv.sortChangedHandlerHandle = sorter.SortChanged().Attach(func() { col := sorter.SortedColumn() tv.setSortIcon(col, sorter.SortOrder()) - tv.Invalidate() }) } } |