Sign in to follow this  
Followers 0
Logman

How Colorized a rows in ListView after sorting?

2 posts in this topic

#1 ·  Posted (edited)

Hi, I have question about ListView sorting with colorized rows with "Err" value in colD. How set font color for this rows after click on column header?

Thanks

Part of my code:

#include <GuiListView.au3>

Global $MyArr[10]

; dump arr (2D arr), for test not 2D  
_dumpArr_for_test_only()
; GUI
GUICreate("Test",220, 250)
$list_view = GUICtrlCreateListView ("colA|colB|colC|colD",10, 10, 200, 200)
GUICtrlSendMsg($list_view, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
; create rows
For $i = 0 To UBound($MyArr) - 1
    GUICtrlCreateListViewItem($MyArr[$i], $list_view)
    If StringInStr($MyArr[$i],"Err") Then GUICtrlSetColor (-1, 0xFF0000)
Next
Dim $A_DESCENDING[_GUICtrlListView_GetColumnCount ($list_view)]
GUISetState()

Do
  $nMsg = GUIGetMsg ()
   Select
    Case $nMsg = $list_view
            _GUICtrlListView_SimpleSort($list_view, $A_DESCENDING, GUICtrlGetState($list_view))
    Case Else
        ; nothing
   EndSelect
Until $nMsg = $GUI_EVENT_CLOSE

; for help only
Func _dumpArr_for_test_only()
Local $bTmp = true, $sTmp
    For $i = 0 To UBound($MyArr) - 1
        Switch $i
            Case 2, 5, 7
                $sTmp = "Err"
            Case Else
                $sTmp = "OK"
        EndSwitch       
        $bTmp = Not $bTmp
        $MyArr[$i] = $i & "|" & UBound($MyArr)-$i-1  & "|" & $bTmp & "|" & $sTmp
    Next    
EndFunc
Edited by Logman

Share this post


Link to post
Share on other sites



I'm found this method for my problem solution:

#475929

Great!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0