Class LV_Colors v2.0 - 2023-05-06

Post your working scripts, libraries and tools.
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: 2.0-beta.1: Class LV_Colors - alpha.1

02 Dec 2021, 05:35

lexikos wrote:I could not produce any problem with LV_Colors_sample.ahk, even with CLV.Critical := 5 or "Off".
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:

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
eugenesv
Posts: 170
Joined: 21 Dec 2015, 10:11

Re: 2.0-beta.1: Class LV_Colors - alpha.1

06 Dec 2021, 04:51

Would it be possible to make listview headers BOLD / draw them in a custom font with "a simple update" to this library or would that be a totally different mechanism of cell format manipulation?
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: 2.0-beta.1: Class LV_Colors - alpha.1

06 Dec 2021, 05:36

Header controls send own NM_CUSTOMDRAW notifications. During testing I noticed that they are passed to the ListView's OnNotify() handler. ATM they are skipped by

Code: Select all

      If !(This.HWND) || (NumGet(L, "UPtr") != This.HWND)
         Return
If you want to add some custom drawing for headers, you can check for

Code: Select all

 If (NumGet(L, "UPtr") = This.Header) {
    ... add your code here
 }
eugenesv
Posts: 170
Joined: 21 Dec 2015, 10:11

Re: 2.0-beta.1: Class LV_Colors - alpha.1

07 Dec 2021, 09:09

Thanks for the tip

I've finally managed to convert your other subclassing example viewtopic.php?f=76&t=87318 to v2 (the progression of examples from the simpler ones to the more elaborate ones made this possible as it allowed to get to the minimum working example and then add the rest line-by-line that simplified debugging the converted code), but when I thought I'd paste it into your suggested If (NumGet(L, "UPtr") = This.Header) {, I couldn't make it work and think that's due to the fact that you create your own class, so that subclassing is not relevant.
Then I've tried to see if it were possible to remove add This.Header to the != This.HWND filter and somehow change row/item numbers Row := NumGet(L + OffItem, "UPtr") -1 to make your example work with the header line, but also couldn't make it work, only managed to move the starting position to line 2,3 etc, but never above line 1

So, is there a way to "shift" the starting position of your row formatting logic up by one so that it touches the header?
Than I think I'll understand how to separate so that it only touches the header via checking for control IDs
eugenesv
Posts: 170
Joined: 21 Dec 2015, 10:11

Re: 2.0-beta.1: Class LV_Colors - alpha.1

07 Dec 2021, 14:10

Basically, I don't understand why this simplified example of your class doesn't affect the headers even though the same command in the subclassed example does do so (I've marked the puzzling parts with ;;;
Would you kindly explain why this fails?

Code: Select all

;Class_LV_Colors_simple.ahk
Class LV_Colors {
  __New(LV) {
    global dbgTxt
    HWND := Integer(LV.Hwnd)
    If !DllCall("IsWindow", "Ptr", HWND, "UInt") ; invalid HWND
      Throw Error("Invalid HWND!")
    VarSetStrCapacity(&ClassName, 256)
    DllCall("GetClassName", "Ptr",HWND, "Str",ClassName, "Int",256)
    If (ClassName != "SysListView32") ; HWND doesn't belong to a ListView
      Throw Error("LV_Colors requires a ListView control!")
    LV.Opt("+LV0x010000")       ; Set LVS_EX_DOUBLEBUFFER style to avoid drawing issues.
    Header := SendMessage(0x101F, 0, 0, LV) ; LVM_GETHEADER ; Get the header control
    This.LV    	:= LV
    This.HWND  	:= HWND
    This.Header	:= Header
    This.ShowColors()
    This.Critical := 100
  }
  __Delete() {
    This.ShowColors(False)
    If WinExist(This.HWND)
      WinRedraw(This.HWND)
  }
  ShowColors(Apply := True) {
    If (Apply) && !This.HasOwnProp("OnNotifyFunc") {
      This.OnNotifyFunc := ObjBindMethod(This, "NM_CUSTOMDRAW")
      This.LV.OnNotify(-12, This.OnNotifyFunc)
      WinRedraw(This.HWND)
    } Else If !(Apply) && This.HasOwnProp("OnNotifyFunc") {
      This.LV.OnNotify(-12, This.OnNotifyFunc, 0)
      This.OnNotifyFunc := ""
      This.DeleteProp("OnNotifyFunc")
      WinRedraw(This.HWND)
    }
    Return True
  }
  NM_CUSTOMDRAW(LV, L) { ; Return 0x00, 0x20
    global dbgTxt
    Static SizeNMHDR   	:= A_PtrSize*3                   	; Size of NMHDR structure
    Static SizeNCD     	:= SizeNMHDR + 16 + (A_PtrSize*5)	; Size of NMCUSTOMDRAW structure
    Static OffItem     	:= SizeNMHDR + 16 + (A_PtrSize*2)	; Offset of dwItemSpec (NMCUSTOMDRAW)
    Static OffItemState	:= OffItem + A_PtrSize           	; Offset of uItemState (NMCUSTOMDRAW)
    Static OffCT       	:= SizeNCD                       	; Offset of clrText    (NMLVCUSTOMDRAW)
    Static OffCB       	:= OffCT + 4                     	; Offset of clrTextBk  (NMLVCUSTOMDRAW)
    Static OffSubItem  	:= OffCB + 4                     	; Offset of iSubItem   (NMLVCUSTOMDRAW)
    Static ODrawStage  	:= (3 * A_PtrSize)
    Static offHDC      	:= ODrawStage + A_PtrSize

    Static CDRF_NEWFONT          	:= 0x00000002
    Static CDRF_DODEFAULT        	:= 0x00000000
    Static CDRF_NOTIFYITEMDRAW   	:= 0x00000020
    Static CDRF_NOTIFYSUBITEMDRAW	:= 0x00000020

    Critical This.Critical
    If !(This.HWND) || !(This.Header)
      Return
    ctlID := NumGet(L, 0, "UPtr")
    If (ctlID != This.HWND) && (ctlID != This.Header)
      Return
    DrawStage := NumGet(L + SizeNMHDR, "UInt") ; same as +ODrawStage
    If (DrawStage = 0x010001) { ;CDDS_ITEMPREPAINT := 0x00010001
      ;;;+ works on row1
      NumPut("UInt", 0xabcdef, L, OffCT)
      CT  := NumGet(L, OffCT, "Ptr"), dbgTxt .= format("CT`t=0x{1:x}`n", CT)
      ;;;- DOESN'T work here, works in the subclass example
      HDC := NumGet(L, offHDC, "Ptr")
      DllCall("Gdi32.dll\SetTextColor", "Ptr",HDC, "UInt",0xfedcba)
      dbgTT(dbgTxt, Time:=2,id:=3)
      return CDRF_NEWFONT ; was CDRF_DODEFAULT 0x00
    }
    if (DrawStage = 0x000001) { ; CDDS_PREPAINT = 0x000001
      return CDRF_NOTIFYITEMDRAW ; 0x20
    } else {
      return CDRF_DODEFAULT ; 0x00
    }
  }
}
and the calling code of 1 header 1 cell

Code: Select all

; Class_LV_Colors_sample_simple.ahk
global dbgTxt := ""
#Include Class_LV_Colors_simple.ahk
!v::reload
Main := Gui()
MainLV := Main.AddListView("w600 r15 Grid -ReadOnly", ["Col1"])
Loop 1
  MainLV.Add("", "Val" . A_Index, "Val" . A_Index)
CLV := LV_Colors(MainLV) ; Create a new instance of LV_Colors
If !IsObject(CLV) {
  MsgBox("Couldn't create a new LV_Colors object!", "ERROR")
  ExitApp
}
Main.AddRadio("w120 vColors Checked", "Colors").OnEvent(   "Click", WhichColors)
Main.OnEvent("Close", MainClose)
Main.Show()

MainClose(gObj) {
  gObj.Destroy()
  ExitApp
}
WhichColors(Ctl, *) {
  MainLV.Opt("-Redraw")
  MainLV.Opt("+Redraw")
  MainLV.Focus()
}
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: 2.0-beta.1: Class LV_Colors - alpha.1

08 Dec 2021, 11:02

just me wrote:
26 Feb 2021, 06:52
Hi, after some testing it seems that CDDS_ITEMPREPAINT notifications are not received by the monitor function. I don't know why, maybe because the header control is'nt an AHK GUI control?

I didn't remember, sorry!
eugenesv
Posts: 170
Joined: 21 Dec 2015, 10:11

Re: 2.0-beta.1: Class LV_Colors - alpha.1

08 Dec 2021, 12:05

Thanks, had this thought today after rereading that other forum with fresher eyes!

By the way, while trying to find a solution, I've stubmled on the following post that hints that the message target for the header is different vs. the cells, though admittedly this is about subclassing, so might not be relevant (and is covered by This.HWND and This.Header)

NM_CUSTOMDRAW and Listviews in Plain C
WM_NOTIFY / NM_CUSTOMDRAW messages concerning the data cells of the Listview are sent to the WndProc of the Listview's PARENT, in my case the Window containing the Listview. These messages are also sent for some other controls, so be sure to check that the (LPNMHDR)lParam)->hwndFrom identifies the wanted Listview's HWND.
...
WM_NOTIFY / NM_CUSTOMDRAW messages concerning the header of the Listview are sent to the WndProc of the Listview: In my case I had to subclass the Listview in order to create a WndProc for the Listview that I could intercept
lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: 2.0-beta.1: Class LV_Colors - alpha.1

01 Jan 2023, 08:10

just me wrote:
02 Dec 2021, 05:35
Using the following example I can trigger the issues easily by fast wheel scrolling and/or resizing:
13 months later...

I determined that after the freeze, the program is stuck in a loop retrieving WM_PAINT messages from the queue and dispatching them to the ListView. The NM_CUSTOMDRAW handler is still on the stack, so I'd guess that the ListView control isn't designed to handle recursive calls to its window proc for WM_PAINT. The reason this would cause a loop is explained in What happens if I don't paint when I get a WM_PAINT message? - The Old New Thing.
lexikos wrote: I timed the bulk of the NM_CUSTOMDRAW method and found that each call is taking around 0.020ms, which is not long enough to trigger a check for messages.
It shouldn't be, but it is. Critical 100 fails to solve the issue because every so often, the program would perform a check for messages before Critical is executed.

By design, the "peek frequency" and "last peek time" are checked before each line of code executes, and a message check occurs if the elapsed time exceeds the peek frequency. Threads default to non-critical, which means the peek frequency defaults to 5ms. The system tick count generally has a granularity of 15.6ms. If the tick count hasn't updated for 15.599999ms, we can check it twice within 0.000001ms and get a delta of 15-16ms. So in other words, a value of 5 doesn't guarantee 5ms passing before the first or next message check; it averages out to one message check for each interval of the tick count, because every time the tick count changes, it has changed by more than 5.

Because v1 was designed around labels as subroutines, it was designed to check the first line of the subroutine and potentially make the thread critical before Critical is called. In that case, the peek frequency defaulted to 16. This more or less guaranteed at least 16ms would pass before a message check, as long as the first line of the subroutine was a call to the Critical command.

The peek frequency doesn't need to be accurate, but scripts like LV_Colors need to be able to prevent a message check from occurring. In order to guarantee that any new thread will be able to call Critical n or set A_IsCritical := n before the first message check, v2.0.1 simply increases each thread's default peek frequency to 16 until the thread becomes interruptible.
2.0.1
Fixed new threads being unable to prevent a message check with Critical.
This is likely to help even if Critical isn't used, because it will be much less likely to perform a message check within the first 16ms of the function being called.

kczx3 wrote:
29 Nov 2021, 09:14
I still don't understand what AHK is doing internally that causes this. I've had a test script with AutoIt that does all kinds of custom drawing with a listview and images and colored/wrapped drawn text and never have any painting or freezing issues.
AutoHotkey preempts the NM_CUSTOMDRAW handling function (or whatever happens to be running), checking the message queue in order to keep UI responsive and (if not Critical) handle hotkeys and other events. I'm guessing AutoIt only checks its message queue while it is idle, in Sleep, GUIGetMsg or similar.

eugenesv wrote:
08 Dec 2021, 12:05
By the way, while trying to find a solution, I've stubmled on the following post that hints that the message target for the header is different vs. the cells
Notifications are sent by a control to its parent. The header control's parent is the ListView. Apparently the ListView forwards some of the header control's notifications to the GUI, because it does receive some; but maybe it doesn't forward all of the notifications.
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: 2.0-beta.1: Class LV_Colors - alpha.1

02 Jan 2023, 06:11

@lexikos: After some quick testing it seems that the 'freezing problem' is solved or, at least, will occur much less often. Thank you very much! Happy new year!
lexikos wrote:So in other words, a value of 5 doesn't guarantee 5ms passing before the first or next message check;
I always wondered how an interval of 5 ms can be guaranteed depending on the tick count.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: 2.0-beta.1: Class LV_Colors - alpha.1

02 Jan 2023, 08:44

I was testing a bit yesterday and it seemed to work much better as well. I wasn’t able to recreate the freeze. However, there was one specific scenario I wanted to test that I wasn’t able to for some reason. I couldn’t get a ListView to function correctly when the Header control has HDS_FULLDRAG where I know that has caused freezing in the past when resizing a column
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: 2.0-beta.1: Class LV_Colors - alpha.1

03 Jan 2023, 12:54

Must have been something going on with my machine because after rebooting I can see the HDS_FULLDRAG style is working now. Still can't make it lock up :) Awesome that this long standing issue is resolved! Thanks!
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class LV_Colors v2.0 - 2023-01-04

04 Jan 2023, 10:27

Released fully featured v2.0 today.
neogna2
Posts: 586
Joined: 15 Sep 2016, 15:44

Re: Class LV_Colors v2.0 - 2023-01-04

09 Jan 2023, 06:14

This class is great!
@just me A feature request: bold, italic, underline, strikethrough font modes for individual cells alongside the color options. This v1 code from the old forum does that. (One LogFont instance must be changed to &LogFont for the code to work, as noted in a later comment.)
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class LV_Colors v2.0 - 2023-01-04

10 Jan 2023, 05:46

@neogna2,
the v1.0 code changes the font weight of whole rows dependent on the text color. Also, it creates a new font for every affected row without freeing the GDI objects.
I'm happy that the freezing of the ListViews was solved with AHK 2.0.1.
neogna2
Posts: 586
Joined: 15 Sep 2016, 15:44

Re: Class LV_Colors v2.0 - 2023-01-04

10 Jan 2023, 14:40

just me wrote:
10 Jan 2023, 05:46
the v1.0 code changes the font weight of whole rows dependent on the text color.
Also, it creates a new font for every affected row without freeing the GDI objects.
I'm happy that the freezing of the ListViews was solved with AHK 2.0.1.
Ok, let me rework the request: Support for bold/italics/underline/strikethrough for cells (if possible) or rows if doable without causing freezing or other negative impacts on existing LV_Colors features. But maybe not possible? I tried to convert that v1 code to v2 but got stuck at DecodeInteger() and other places.
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class LV_Colors v2.0 - 2023-01-04

12 Jan 2023, 07:42

@neogna2, that's what the v1.0 code you linked is actually doing:

Code: Select all

MainGui := Gui( , "Main")
MainLV := MainGui.AddListView( , ["Column1", "Column2"])
LV_col := 1
MainLV.Add( "", "val11", "val12")
MainLV.Add( "", "val21", "val22")
MainLV.Add( "", "val31", "val32")
MainLV.ModifyCol(1, "AutoHdr")
MainLV.ModifyCol(2, "AutoHdr")
MainGui.Show()
MainLV_Table := Map()
MainLV_Table["val21"] := "0x0000FF" ; BGR
MainLV.OnNotify(-12, MainLV_CustomDraw) ; NM_CUSTOMDRAW notification
WinRedraw(MainLV)
Return

MainLV_CustomDraw(LV, L) {
   Static SizeNMHDR := A_PtrSize * 3                  ; Size of NMHDR structure
   Static SizeNCD := SizeNMHDR + 16 + (A_PtrSize * 5) ; Size of NMCUSTOMDRAW structure
   Static OffItem := SizeNMHDR + 16 + (A_PtrSize * 2) ; Offset of dwItemSpec (NMCUSTOMDRAW)
   Static OffItemState := OffItem + A_PtrSize         ; Offset of uItemState  (NMCUSTOMDRAW)
   Static OffCT :=  SizeNCD                           ; Offset of clrText (NMLVCUSTOMDRAW)
   Static OffCB := OffCT + 4                          ; Offset of clrTextBk (NMLVCUSTOMDRAW)
   Static OffSubItem := OffCB + 4                     ; Offset of iSubItem (NMLVCUSTOMDRAW)
   DrawStage := NumGet(L + SizeNMHDR, "UInt"),
   Row := NumGet(L + OffItem, "UPtr") + 1,
   Col := NumGet(L + OffSubItem, "Int") + 1,
   Item := Row - 1
   Switch DrawStage {
      Case 0x000001: ; CDDS_PREPAINT
         Return 0x20 ; CDRF_NOTIFYITEMDRAW
      Case 0x010001: ; CDDS_ITEMPREPAINT
         Row := NumGet(L + OffItem, "UPtr") + 1,
         Col := NumGet(L + OffSubItem, "Int") + 1,
         Item := Row - 1
         RowText := LV.GetText(Row, Col)
         If MainLV_Table.Has(RowText) {
            TxtClr := MainLV_Table[RowText]
            If (TxtClr != "")
               NumPut("UInt", TxtClr, L + OffCT) ; NMLVCUSTOMDRAW->clrText ; foreground
            HFNT := SendMessage(0x31, 0, 0, LV)	; WM_GETFONT
            LOGFONT := Buffer(92, 0)
            DllCall("GetObject", "Ptr", HFNT, "Int", 92, "Ptr", LOGFONT)
            NumPut("UInt", 700, LOGFONT, 16)
            HFNT := DllCall("CreateFontIndirect", "Ptr", LOGFONT, "UPtr")
            HDC := NumGet(L, A_PtrSize * 4, "UPtr")
            DllCall("SelectObject", "Ptr", HDC, "Ptr", HFNT)
            Return 0x02 ; CDRF_NEWFONT
         }
         Return 0x00 ; CDRF_DODEFAULT
      Default:
         Return 0x00 ; CDRF_DODEFAULT
   }
}
kazhafeizhale
Posts: 77
Joined: 25 Dec 2018, 10:58

Re: Class LV_Colors v2.0 - 2023-01-04

12 Jan 2023, 12:02

@just me
There is some conflict, when use LV_Colors and ListViewExtensions_Add.
if use SetBkImage func, the selection color is not correct.

Code: Select all

		
		CLV := LV_Colors(LV)
		CLV.SelectionColors(cfg['win_list_focus_back_color'], cfg['win_list_focus_text_color'] )

		ListViewExtensions_Add(LV)
		LV.SetBkImage('a.png', 200)
image.png
image.png (50.07 KiB) Viewed 3277 times
image.png
image.png (38.92 KiB) Viewed 3277 times
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class LV_Colors v2.0 - 2023-01-04

13 Jan 2023, 05:17

@kazhafeizhale
It doesn't seem to be a conflict between classes, it seems to be default list-view behaviour.
I have to remove the CDIS_SELECTED (0x0001) and CDIS_FOCUS (0x0010) states from the item to force the list-view to use the specified colours for selected rows.
If I don't do it, the list-view uses the default selection colours for the text as well as the background.
If I do it for a list-view with a background image it apparently ignores the specified background colour and copies the current background instead. But it uses the specified text colour allowing to get some visual feedback.
fenchai
Posts: 292
Joined: 28 Mar 2016, 07:57

Re: Class LV_Colors v2.0 - 2023-01-04

12 Mar 2023, 18:32

Long time fan of your work, thanks for v1 and now v2!

I have an issue with the library.

so far, I have tested: SelectionColors() and the Alt{x}() methods work perfectly.
but I haven't gotten the luck of making .Cell() and .Row() methods work.

is there something I am missing here?

Code: Select all

mainGui() {
    global

    headers := ["Fecha"
        , "Descripcion", "Debito", "Credito", "Saldo", "Verificado"]
    tabNames := ["Banco General", "Global Bank"]

    main := Gui(, "Bank Records")
    main.Opt("")
    tabs := main.AddTab3(, tabNames)

    tabs.UseTab(1)
    main.AddText("Section", "Buscar:")

    BgFilter := main.AddEdit("xs")
    BgFilter.OnEvent("change", (*) => debouncer(() => fillBGeneralRecords(BgFilter.Value)))
    BgLV := main.AddListView("r40 w1200 Grid -ReadOnly vBgLV", headers)
    BgLV.OnEvent("DoubleClick", LVDoubleClickEvent)
    BgCLV := LV_Colors(BgLV, , true, true)
    BgCLV.SelectionColors(0x2A74A4, 0xFDFDFD)

    main.AddButton("Section xs", "Acceder").OnEvent("Click", BgBtn_Access)
    main.AddButton("xs", "Acceder + Descargar Estado de Cuenta").OnEvent("Click", BgBtn_Update)

    tabs.UseTab(2)
    main.AddText("Section", "Buscar:")
    GbFilter := main.AddEdit("xs")
    GbFilter.OnEvent("Change", (*) => debouncer(() => fillGlobalBRecords(GbFilter.Value)))
    GbLV := main.AddListView("r40 w1200 Grid -ReadOnly vGbLV", headers)
    GbCLV := LV_Colors(GbLV, , true, true)
    GbCLV.SelectionColors(0x2AA46E, 0xFDFDFD)
    GbLV.OnEvent("DoubleClick", LVDoubleClickEvent)

    main.AddButton("Section xs", "Acceder").OnEvent("Click", GbBtn_Access)
    main.AddButton("xs", "Acceder + Descargar Estado de Cuenta").OnEvent("Click", GbBtn_Update)

    fillBGeneralRecords()
    fillGlobalBRecords()

    modifyBGeneralRecordCols()
    modifyGlobalBRecordCols()

    ; msgbox IsObject(BgCLV) ; returns 1
    ; BgCLV.AlternateCols(0x808080, 0xFFFFFF) ;this works
    BgCLV.Row(1, 0x00FF00, 0x000080) ; this does not work (returns 0)

    BgCLV.ShowColors()

    main.Show()

    main.OnEvent('DropFiles', BgDropFile)
}
just me
Posts: 9423
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class LV_Colors v2.0 - 2023-01-04

13 Mar 2023, 03:41

Currently you might need to call BgCLV.UpdateProps() after you changed the LVs contents.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: No registered users and 24 guests