summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-10-28 12:43:15 +0100
committerAlexander Neumann <alexander.neumann@picos-software.com>2019-10-28 12:43:15 +0100
commite4edf856f3dbf0583137497f7dab032b734714df (patch)
tree81cee92a9b4c34f617c7063d29ca3c6c524adc7a
parentMerge pull request #635 from zx2c4-forks/scrolltable (diff)
downloadwireguard-windows-e4edf856f3dbf0583137497f7dab032b734714df.tar.xz
wireguard-windows-e4edf856f3dbf0583137497f7dab032b734714df.zip
TableView: Avoid flicker when updating items
-rw-r--r--tableview.go11
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()
})
}
}