The issues occur increased with large controls containing many visible rows and columns. From my observations they might be related to mouse actions like scrolling by wheel, resizing columns and clicking a header item. Using the following example I can trigger the issues easily by fast wheel scrolling and/or resizing:lexikos wrote:I could not produce any problem with LV_Colors_sample.ahk, even with CLV.Critical := 5 or "Off".
Code: Select all
Main := Gui("", "ListView & Colors")
Main.MarginX := 20
Main.MarginY := 20
Header := ["Column 1", "Column 2", "Column 3", "Column 4", "Column 5", "Column 6", "Column 7", "Column 8"]
MainLV := Main.AddListView("w800 r30 cBlue Grid -ReadOnly", Header)
Loop 256
MainLV.Add("", "Value " . A_Index, "Value " . A_Index, "Value " . A_Index, "Value " . A_Index, "Value " . A_Index,
"Value " . A_Index, "Value " . A_Index, "Value " . A_Index)
Loop MainLV.GetCount("Column")
MainLV.ModifyCol(A_Index, 95)
; Create a new instance of LV_Colors
CLV := LV_Colors(MainLV, 0, 0, 0)
; CLV.Critical := 100
If !IsObject(CLV) {
MsgBox("Couldn't create a new LV_Colors object!", "ERROR")
ExitApp
}
; Set the colors for selected rows
CLV.SelectionColors(0xF0F0F0)
Main.AddCheckBox("w120 vColorsOn Checked", "Colors On").OnEvent("Click", ShowColors)
Main.AddRadio("x+0 yp wp vNone", "No Colors").OnEvent("Click", WhichColors)
Main.AddRadio("x+0 yp wp vColors Checked", "Colors").OnEvent("Click", WhichColors)
Main.OnEvent("Close", MainClose)
Main.OnEvent("Escape", MainClose)
Main.Show()
WhichColors({Name: "Colors"})
; ----------------------------------------------------------------------------------------------------------------------
MainClose(*) {
Main.Destroy()
ExitApp
}
; ----------------------------------------------------------------------------------------------------------------------
ShowColors(Ctl, *) {
CLV.ShowColors(Ctl.Value)
MainLV.Focus()
}
; ----------------------------------------------------------------------------------------------------------------------
WhichColors(Ctl, *) {
MainLV.Opt("-Redraw")
CLV.Clear()
Switch Ctl.Name {
Case "Colors":
SetColors(CLV)
}
MainLV.Opt("+Redraw")
MainLV.Focus()
}
; ----------------------------------------------------------------------------------------------------------------------
SetColors(CLV) {
Loop CLV.LV.GetCount() {
CLV.Cell(A_Index, A_Index & 1 ? 1 : 2, 0x808080, 0xFFFFFF)
CLV.Cell(A_Index, A_Index & 1 ? 3 : 4, 0x808080, 0xFFFFFF)
CLV.Cell(A_Index, A_Index & 1 ? 5 : 6, 0x808080, 0xFFFFFF)
CLV.Cell(A_Index, A_Index & 1 ? 7 : 8, 0x808080, 0xFFFFFF)
}
}
; ----------------------------------------------------------------------------------------------------------------------
#Include Class_LV_Colors.ahk