Jump to content

list view color issues


Recommended Posts

hi all,

I have a problem with this code. attached pictures.

when the code is calling _SubItemColSet it is changing the requested subitem but also changes the first line, And I don't see why!

;this file is for monitoring the status of CM server 199.
Opt("GUIOnEventMode", 1)
#include <File.au3>
#include <Array.au3>
#include <GUIconstants.au3>
#include <String.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

#region - required declarations for coloring and font
Global $hFont, $defColLV = 0x000000, $defBkColLV = 0xFFFFEE
; Font long = $nHeight, $nWidth[, $nEscape = 0[, $nOrientn = 0[, $fnWeight = $FW_NORMAL[,
;          $bItalic = False[, $bUnderline = False[, $bStrikeout = False[, $nCharset = $DEFAULT_CHARSET[,
;          $nOutputPrec = $OUT_DEFAULT_PRECIS[, $nClipPrec = $CLIP_DEFAULT_PRECIS[, $nQuality = $DEFAULT_QUALITY[,
;          $nPitch = 0[, $szFace = 'Arial']]]]]]]]]]]])]
; for distinction:
;          $nHeight with leading '-' by using Font long !!
; Font short = $nHeight, $fnWeight, $szFace

Global $aSubItemSet[1][5] = [[-1]]  ; [$i][$iItem, $iSubItem, $iBkCol, $iCol, $sFont]
;~ if [0][0] = -1
;~ $aSubItemSet[0][1] = 0 SubItem-Mode, -1 rows rotatory, -2 columns rotatory, -3 single row, -4 single column
;~ $aSubItemSet[0][2] = odd row/column Bk-Color or single row/column Bk-Color
;~ $aSubItemSet[0][3] = even row/column Bk-Color or single row/column Text-Color
;~ $aSubItemSet[0][4] = row or column (if [0][1]= -3 or -4)
#endregion

Global $setIndex, $setSubIndex
;MsgBox (0,"this is default quelity",$DEFAULT_CHARSET)

Dim $EREZ[700]
Global $skill330[10], $skill910[10]
$ipaddr = "9.148.218.20"
$port = 23
TCPStartup()
$i = 1

Dim $ConnectedSocket = -1

;=======================================================
$ConnectedSocket = TCPConnect($ipaddr, $port)

Sleep(600)
TCPSend($ConnectedSocket, Binary("0xfffb18fffb1f"))

TCPSend($ConnectedSocket, Binary("0xfffc20fffc23fffb27"))
Sleep(200)
TCPSend($ConnectedSocket, Binary("0xfffa1f00500019fff0"))
Sleep(200)

TCPSend($ConnectedSocket, Binary("0xfffa2700fff0"))
TCPSend($ConnectedSocket, Binary("0xfffa1800414e5349fff0"))
Sleep(200)
TCPSend($ConnectedSocket, Binary("0xfffd03"))
Sleep(10)
TCPSend($ConnectedSocket, Binary("0xfffb01fffe05fffc21"))
Sleep(200)
TCPSend($ConnectedSocket, Binary("0xfffc01"))
Sleep(200)
TCPSend($ConnectedSocket, Binary("0xfffd01"))
Sleep(1000)
TCPSend($ConnectedSocket, "ibm")
Sleep(500)
TCPSend($ConnectedSocket, Binary("0x0d"))
Sleep(1000)
TCPSend($ConnectedSocket, "ibm4isr")
Sleep(1000)
TCPSend($ConnectedSocket, Binary("0x0d"))
Sleep(1000)
TCPSend($ConnectedSocket, "w2ktt")
Sleep(500)
TCPSend($ConnectedSocket, Binary("0x0d"))
Sleep(1500)
;==start monitoring skill 330=======
TCPSend($ConnectedSocket, "monitor bcms skill 110")
Sleep(1000)
TCPSend($ConnectedSocket, Binary("0x0d"))
Sleep(1500)
;====================writing to file=====
$m = TCPRecv($ConnectedSocket, 16000, 1)
$J = FileOpen("c:\199main.txt", 2)
FileWrite($J, $m)
FileClose($J)
;===========exit skill 330=======
;TCPSend ($ConnectedSocket,Binary ("0x1b78"))
_FileReadToArray("c:\199main.txt", $EREZ)
;_ArrayDisplay ($EREZ)
;_ArrayDisplay ($EREZ)

$FileOrig = "c:\199main.txt"
$sfileread = FileRead($FileOrig)
$sfileread = StringReplace($sfileread, Chr(0), "")
;$sfileread = StringReplace($sfileread, Chr(13), "")
$FileResult = "c:\199main-1.txt"
$hFile = FileOpen($FileResult, 2)
FileWrite($hFile, $sfileread)
FileClose($hFile)
$Read = FileRead("c:\199main-1.txt")
$Replace = StringReplace($Read, "", "")
$Replace = StringReplace($Replace, Chr("7f"), "")
$EREZ = StringSplit($Replace, "[")
;_ArrayDisplay($EREZ)

$s1 = _ArraySearch($EREZ, "BCMS SKILL (AGENT) STATUS", 0, 0, 1, 1)
;MsgBox(0, "this is $s1", $s1)
;_ArrayDisplay($EREZ)
;===================================starting skill 110==================
;===========date================
$trim1 = $EREZ[$s1 + 4]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[1] = $trim1
;MsgBox (0,"this is date",$skill330[1])
;==============queue number and name==============
$trim1 = $EREZ[$s1 + 2]
$trim1 = StringTrimLeft($trim1, 5)
$skill330[2] = $trim1
$trim1 = $EREZ[$s1 + 6]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[2] = $skill330[2] & " " & $trim1
;MsgBox (0,"this is skill number and name",$skill330[2])
;========================calls waiting=================
$trim1 = $EREZ[$s1 + 8]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[3] = $trim1
;MsgBox (0,"this is the call-waiting",$skill330[3])
;============================oldest call waiting============
$trim1 = $EREZ[$s1 + 12]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[4] = $trim1
;MsgBox (0,"this is the oldest call-waiting",$skill330[4])
;=====================Check service level=======================
$t1 = StringInStr($EREZ[$s1 + 14], "Staffed")
If $t1 > 0 Then
    $t2 = 15
Else
    $t2 = 16
EndIf
;=====================Staffed Agents==========================
$trim1 = $EREZ[$s1 + $t2]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[5] = $trim1
;MsgBox (0,"this is the staffed agents",$skill330[5])
;=========================Avail agents======================
$trim1 = $EREZ[$s1 + $t2 + 2]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[6] = $trim1
;MsgBox (0,"this is the Avail agents",$skill330[6])
;==========================on ACD calls=====================
$trim1 = $EREZ[$s1 + $t2 + 4]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[7] = $trim1
;MsgBox (0,"this is the On ACD calls agents",$skill330[7])
;============================Aux agents======================
$trim1 = $EREZ[$s1 + $t2 + 8]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[8] = $trim1
;MsgBox (0,"this is the On AUX agents",$skill330[8])
;===========================Extenal calls agents=======================
$trim1 = $EREZ[$s1 + $t2 + 10]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill330[9] = $trim1
;MsgBox (0,"this is the On Ext calls agents",$skill330[9])
;===============================================================
;_ArrayDisplay($skill330)
;===============================================================
;=============Starting skill 910=====================================
dim $EREZ[700]
TCPSend($ConnectedSocket, Binary("0x1b78"))
Sleep(1500)
TCPSend($ConnectedSocket, "monitor bcms skill 910")
Sleep(1000)
TCPSend($ConnectedSocket, Binary("0x0d"))
Sleep(1500)
;====================writing to file=====
$m = TCPRecv($ConnectedSocket, 16000, 1)
$J = FileOpen("c:\199main.txt", 2)
FileWrite($J, $m)
FileClose($J)
;===========exit skill 330=======
;TCPSend ($ConnectedSocket,Binary ("0x1b78"))
_FileReadToArray("c:\199main.txt", $EREZ)
;_ArrayDisplay ($EREZ)
;_ArrayDisplay ($EREZ)

$FileOrig = "c:\199main.txt"
$sfileread = FileRead($FileOrig)
$sfileread = StringReplace($sfileread, Chr(0), "")
;$sfileread = StringReplace($sfileread, Chr(13), "")
$FileResult = "c:\199main-1.txt"
$hFile = FileOpen($FileResult, 2)
FileWrite($hFile, $sfileread)
FileClose($hFile)
$Read = FileRead("c:\199main-1.txt")
$Replace = StringReplace($Read, "", "")
$Replace = StringReplace($Replace, Chr("7f"), "")
$EREZ = StringSplit($Replace, "[")
;_ArrayDisplay($EREZ)

$s1 = _ArraySearch($EREZ, "BCMS SKILL (AGENT) STATUS", 0, 0, 1, 1)
;MsgBox(0, "this is $s1", $s1)
;_ArrayDisplay($EREZ)
;===================================starting skill 110==================
;===========date================
$trim1 = $EREZ[$s1 + 4]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[1] = $trim1
;MsgBox (0,"this is date",$skill330[1])
;==============queue number and name==============
$trim1 = $EREZ[$s1 + 2]
$trim1 = StringTrimLeft($trim1, 5)
$skill910[2] = $trim1
$trim1 = $EREZ[$s1 + 6]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[2] = $skill910[2] & " " & $trim1
;MsgBox (0,"this is skill number and name",$skill330[2])
;========================calls waiting=================
$trim1 = $EREZ[$s1 + 8]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[3] = $trim1
;MsgBox (0,"this is the call-waiting",$skill330[3])
;============================oldest call waiting============
$trim1 = $EREZ[$s1 + 12]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[4] = $trim1
;MsgBox (0,"this is the oldest call-waiting",$skill330[4])
;=====================Check service level=======================
$t1 = StringInStr($EREZ[$s1 + 14], "Staffed")
If $t1 > 0 Then
    $t2 = 15
Else
    $t2 = 16
EndIf
;=====================Staffed Agents==========================
$trim1 = $EREZ[$s1 + $t2]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[5] = $trim1
;MsgBox (0,"this is the staffed agents",$skill330[5])
;=========================Avail agents======================
$trim1 = $EREZ[$s1 + $t2 + 2]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[6] = $trim1
;MsgBox (0,"this is the Avail agents",$skill330[6])
;==========================on ACD calls=====================
$trim1 = $EREZ[$s1 + $t2 + 4]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[7] = $trim1
;MsgBox (0,"this is the On ACD calls agents",$skill330[7])
;============================Aux agents======================
$trim1 = $EREZ[$s1 + $t2 + 8]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[8] = $trim1
;MsgBox (0,"this is the On AUX agents",$skill330[8])
;===========================Extenal calls agents=======================
$trim1 = $EREZ[$s1 + $t2 + 10]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[9] = $trim1


;=====================Displaying the results for the first time!====================
GUICreate("ACD Status 199", 1000, 500, 10, 10)
GUISetBkColor(0xFFFFFF)  ; will change background color
;$list=GUICtrlCreateListView ("EXT שיחות|סוכנים בהפסקה| ACD שיחות|וכנימינים | כמות סוכנים | זמן המתנה | שיחות ממתינות| תור",50,30,873,400)
$cListView = GUICtrlCreateListView("EXT שיחות|סוכנים בהפסקה| ACD שיחות|סוכנים זמינים| כמות סוכנים | זמן המתנה | שיחות ממתינות| תור", 50, 30, 873, 400,-1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
$hListView = GUICtrlGetHandle($cListView)
$item1 = GUICtrlCreateListViewItem($skill330[9] & "|" & $skill330[8] & "|" & $skill330[7] & "|" & $skill330[6] & "|" & $skill330[5] & "|" & $skill330[4] & "|" & $skill330[3] & "|" & $skill330[2], $cListView)
$item2 = GUICtrlCreateListViewItem($skill910[9] & "|" & $skill910[8] & "|" & $skill910[7] & "|" & $skill910[6] & "|" & $skill910[5] & "|" & $skill910[4] & "|" & $skill910[3] & "|" & $skill910[2], $cListView)
;GUICtrlSetFont($item1, 9)
GUISetOnEvent($GUI_EVENT_CLOSE, "erez2")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_OneRowSetCol(0)

GUISetState()       ; will display an empty dialog box



; Run the GUI until the dialog is closed
While 1

    Call("erez")
    _SubItemColSet(1, 5, '0xFFEEEE', '0xFF0000', '16,400,Arial')
    ;_SubItemColSet(0, 1, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;_SubItemColSet(0, 2, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;_SubItemColSet(0, 3, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;_SubItemColSet(0, 4, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;_SubItemColSet(0, 5, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;_SubItemColSet(0, 6, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;_SubItemColSet(0, 7, '0xFFFFFF');, '0xFF0000', '14,700,Courier New')
    ;Sleep(3000)
    ;_SubItemColOff(0, 0)
    sleep (5000)
     _OneRowSetCol(0)
    ;If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd








Func erez()

    Dim $EREZ[700]
    ;===============monitor skill 330 again=================
    TCPSend($ConnectedSocket, Binary("0x1b78"))
    Sleep(1500)
    TCPSend($ConnectedSocket, "monitor bcms skill 110")
    Sleep(1000)
    TCPSend($ConnectedSocket, Binary("0x0d"))
    Sleep(1500)
    ;====================writing to file=====
    $m = TCPRecv($ConnectedSocket, 16000, 1)
    $J = FileOpen("c:\199main.txt", 2)
    FileWrite($J, $m)
    FileClose($J)
    ;===========exit skill 330=======
    ;TCPSend ($ConnectedSocket,Binary ("0x1b78"))
    ;_FileReadToArray("c:\199main.txt", $EREZ)
    ;_ArrayDisplay ($EREZ)



    _FileReadToArray("c:\199main.txt", $EREZ)
;   _ArrayDisplay ($EREZ)

    $FileOrig = "c:\199main.txt"
    $sfileread = FileRead($FileOrig)
    $sfileread = StringReplace($sfileread, Chr(0), "")
    ;$sfileread = StringReplace($sfileread, Chr(13), "")
    $FileResult = "c:\199main-1.txt"
    $hFile = FileOpen($FileResult, 2)
    FileWrite($hFile, $sfileread)
    FileClose($hFile)
    $Read = FileRead("c:\199main-1.txt")
    $Replace = StringReplace($Read, "", "")
    $Replace = StringReplace($Replace, Chr("7f"), "")
    $EREZ = StringSplit($Replace, "[")
    ;_ArrayDisplay($EREZ)

    $s1 = _ArraySearch($EREZ, "BCMS SKILL (AGENT) STATUS", 0, 0, 1, 1)
    ;MsgBox (0,"this is $s1",$s1)
    ;===========date================
    $trim1 = $EREZ[$s1 + 4]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[1] = $trim1
    ;MsgBox (0,"this is date",$skill330[1])
    ;==============queue number and name==============
    $trim1 = $EREZ[$s1 + 2]
    $trim1 = StringTrimLeft($trim1, 5)
    $skill330[2] = $trim1
    $trim1 = $EREZ[$s1 + 6]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[2] = $skill330[2] & " " & $trim1
    ;MsgBox (0,"this is skill number and name",$skill330[2])
    ;========================calls waiting=================
    $trim1 = $EREZ[$s1 + 8]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[3] = $trim1
    ;MsgBox (0,"this is the call-waiting",$skill330[3])
    ;============================oldest call waiting============
    $trim1 = $EREZ[$s1 + 12]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[4] = $trim1
    ;MsgBox (0,"this is the oldest call-waiting",$skill330[4])
    ;=====================Staffed Agents=======================
    ; == == == == == == == == == == =Check service level == == == == == == == == == == == =
    $t1 = StringInStr($EREZ[$s1 + 14], "Staffed")
    If $t1 > 0 Then
        $t2 = 15
    Else
        $t2 = 16
    EndIf
    ;=====================Staffed Agents==========================
    $trim1 = $EREZ[$s1 + $t2]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[5] = $trim1
    ;MsgBox (0,"this is the staffed agents",$skill330[5])
    ;=========================Avail agents======================
    $trim1 = $EREZ[$s1 + $t2 + 2]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[6] = $trim1
    ;MsgBox (0,"this is the Avail agents",$skill330[6])
    ;==========================on ACD calls=====================
    $trim1 = $EREZ[$s1 + $t2 + 4]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[7] = $trim1
    ;MsgBox (0,"this is the On ACD calls agents",$skill330[7])
    ;============================Aux agents======================
    $trim1 = $EREZ[$s1 + $t2 + 8]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[8] = $trim1
    ;MsgBox (0,"this is the On AUX agents",$skill330[8])
    ;===========================Extenal calls agents=======================
    $trim1 = $EREZ[$s1 + $t2 + 10]
    $trim1 = StringTrimLeft($trim1, 5)
    $trim1 = StringStripWS($trim1, 2)
    $skill330[9] = $trim1
    ;MsgBox (0,"this is the On Ext calls agents",$skill330[9])
    ;===============================================================
    ;_ArrayDisplay ($skill330)
    ;===============================================================
    ;=============Starting skill 910=====================================
TCPSend($ConnectedSocket, Binary("0x1b78"))
Sleep(1500)
TCPSend($ConnectedSocket, "monitor bcms skill 910")
Sleep(1000)
TCPSend($ConnectedSocket, Binary("0x0d"))
Sleep(1500)
;====================writing to file=====
$m = TCPRecv($ConnectedSocket, 16000, 1)
$J = FileOpen("c:\199main.txt", 2)
FileWrite($J, $m)
FileClose($J)
;===========exit skill 330=======
;TCPSend ($ConnectedSocket,Binary ("0x1b78"))
_FileReadToArray("c:\199main.txt", $EREZ)
;_ArrayDisplay ($EREZ)
;_ArrayDisplay ($EREZ)

$FileOrig = "c:\199main.txt"
$sfileread = FileRead($FileOrig)
$sfileread = StringReplace($sfileread, Chr(0), "")
;$sfileread = StringReplace($sfileread, Chr(13), "")
$FileResult = "c:\199main-1.txt"
$hFile = FileOpen($FileResult, 2)
FileWrite($hFile, $sfileread)
FileClose($hFile)
$Read = FileRead("c:\199main-1.txt")
$Replace = StringReplace($Read, "", "")
$Replace = StringReplace($Replace, Chr("7f"), "")
$EREZ = StringSplit($Replace, "[")
;_ArrayDisplay($EREZ)

$s1 = _ArraySearch($EREZ, "BCMS SKILL (AGENT) STATUS", 0, 0, 1, 1)
;MsgBox(0, "this is $s1", $s1)
;_ArrayDisplay($EREZ)
;===================================starting skill 910==================
;===========date================
$trim1 = $EREZ[$s1 + 4]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[1] = $trim1
;MsgBox (0,"this is date",$skill330[1])
;==============queue number and name==============
$trim1 = $EREZ[$s1 + 2]
$trim1 = StringTrimLeft($trim1, 5)
$skill910[2] = $trim1
$trim1 = $EREZ[$s1 + 6]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[2] = $skill910[2] & " " & $trim1
;MsgBox (0,"this is skill number and name",$skill330[2])
;========================calls waiting=================
$trim1 = $EREZ[$s1 + 8]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[3] = $trim1
;MsgBox (0,"this is the call-waiting",$skill330[3])
;============================oldest call waiting============
$trim1 = $EREZ[$s1 + 12]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[4] = $trim1
;MsgBox (0,"this is the oldest call-waiting",$skill330[4])
;=====================Check service level=======================
$t1 = StringInStr($EREZ[$s1 + 14], "Staffed")
If $t1 > 0 Then
    $t2 = 15
Else
    $t2 = 16
EndIf
;=====================Staffed Agents==========================
$trim1 = $EREZ[$s1 + $t2]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[5] = $trim1
;MsgBox (0,"this is the staffed agents",$skill330[5])
;=========================Avail agents======================
$trim1 = $EREZ[$s1 + $t2 + 2]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[6] = $trim1
;MsgBox (0,"this is the Avail agents",$skill330[6])
;==========================on ACD calls=====================
$trim1 = $EREZ[$s1 + $t2 + 4]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[7] = $trim1
;MsgBox (0,"this is the On ACD calls agents",$skill330[7])
;============================Aux agents======================
$trim1 = $EREZ[$s1 + $t2 + 8]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[8] = $trim1
;MsgBox (0,"this is the On AUX agents",$skill330[8])
;===========================Extenal calls agents=======================
$trim1 = $EREZ[$s1 + $t2 + 10]
$trim1 = StringTrimLeft($trim1, 5)
$trim1 = StringStripWS($trim1, 2)
$skill910[9] = $trim1
;=======================================displaying the date in loop==================

    GUICtrlSetData($item1, $skill330[9] & "|" & $skill330[8] & "|" & $skill330[7] & "|" & $skill330[6] & "|" & $skill330[5] & "|" & $skill330[4] & "|" & $skill330[3] & "|" & $skill330[2])
    GUICtrlSetData($item2, $skill910[9] & "|" & $skill910[8] & "|" & $skill910[7] & "|" & $skill910[6] & "|" & $skill910[5] & "|" & $skill910[4] & "|" & $skill910[3] & "|" & $skill910[2])

EndFunc   ;==>erez


Func erez2()
    Exit
EndFunc   ;==>erez2

#region - functions for setting color and font
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hListView
            Switch $iCode
                Case $NM_CUSTOMDRAW
                    If Not _GUICtrlListView_GetViewDetails($hWndFrom) Then Return $GUI_RUNDEFMSG
                    Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
                    Local $iDrawStage, $iItem, $iSubitem, $hDC, $tRect
                    $iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage')
                    Switch $iDrawStage
                        Case $CDDS_ITEMPREPAINT
                            Return $CDRF_NOTIFYSUBITEMDRAW
                        Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM)
                            $iItem = DllStructGetData($tCustDraw, 'dwItemSpec')
                            $iSubitem = DllStructGetData($tCustDraw, 'iSubItem')
                            _SetItemCol($hDC, $tCustDraw, $iItem, $iSubitem)
                            Return $CDRF_NEWFONT
                    EndSwitch
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _SetItemCol(ByRef $hDC, ByRef $tCustDraw, $iItem, $iSubitem)
    If $aSubItemSet[0][0] = -1 Then
        If $aSubItemSet[0][1] < 0 Then
            Switch $aSubItemSet[0][1]
                Case -1 ; Zeilen abwechselnd fהrben
                    If Mod($iItem, 2) Then ; ungerade
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
                    Else
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][3]))
                    EndIf
                Case -2 ; Spalten abwechselnd fהrben
                    If Mod($iSubItem, 2) Then ; ungerade
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
                    Else
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][3]))
                    EndIf
                Case -3 ; einzelne Zeile fהrben
                    If $iItem = $aSubItemSet[0][4] Then
                        DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aSubItemSet[0][3]))
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
                    Else
                        DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV))
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV))
                    EndIf
                Case -4 ; einzelne Spalte fהrben
                    If $iSubItem = $aSubItemSet[0][4] Then
                        DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aSubItemSet[0][3]))
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
                    Else
                        DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV))
                        DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV))
                    EndIf
                Case Else
                    Return
            EndSwitch
            $hDC = DllStructGetData($tCustDraw, 'hdc')
            $hFont = _WinAPI_CreateFont(-16,0,0,0,$FW_NORMAL,False,False,False,$DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS, _
                     $CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial')
            _WinAPI_SelectObject($hDC, $hFont)
        EndIf
    Else
        Local $indx, $aIndex = _ArrayFindAll($aSubItemSet, $iItem)
        If @error Then Return
        For $i = 0 To UBound($aIndex) -1
            If $aSubItemSet[$aIndex[$i]][1] = $iSubitem Then
                $indx = $aIndex[$i]
                ExitLoop
            EndIf
        Next
        Local $aDefFont[14] = [-16,0,0,0,$FW_NORMAL,False,False,False, _
                              $DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS,$CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial']
        Local $splitFont = StringSplit($aSubItemSet[$indx][4], ',')
        If StringLeft($splitFont[1], 1) <> '-' Then  ; alternativer FontString?
            $aDefFont[0]  = $splitFont[1]
            $aDefFont[4]  = $splitFont[2]
            $aDefFont[13] = $splitFont[3]
        Else
            For $i = 1 To UBound($splitFont) -1
                If $i = 1 Then
                    $aDefFont[0] = StringTrimLeft($splitFont[1], 1)
                Else
                    $aDefFont[$i-1] = $splitFont[$i]
                EndIf
            Next
        EndIf
        If ($aSubItemSet[$indx][0] = $iItem) And ($aSubItemSet[$indx][1] = $iSubitem) Then
            $hDC = DllStructGetData($tCustDraw, 'hdc')
            DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aSubItemSet[$indx][3]))
            DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[$indx][2]))
            $hFont = _WinAPI_CreateFont($aDefFont[0],$aDefFont[1],$aDefFont[2],$aDefFont[3],$aDefFont[4],$aDefFont[5],$aDefFont[6], _
                     $aDefFont[7],$aDefFont[8],$aDefFont[9],$aDefFont[10],$aDefFont[11],$aDefFont[12],$aDefFont[13])
            _WinAPI_SelectObject($hDC, $hFont)
        Else
            $hDC = DllStructGetData($tCustDraw, 'hdc')
            DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV))
            DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV))
            $hFont = _WinAPI_CreateFont(-16,0,0,0,$FW_NORMAL,False,False,False,$DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS, _
                     $CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial')
            _WinAPI_SelectObject($hDC, $hFont)
        EndIf
    EndIf
EndFunc  ;==>_SetItemCol


Func RGB2BGR($iColor)
    Local $sH = Hex($iColor,6)
    Return '0x' & StringRight($sH, 2) & StringMid($sH,3,2) & StringLeft($sH, 2)
EndFunc  ;==>RGB2BGR

Func _SubItemColSet($iItem, $iSubItem, $iBkCol=-1, $iCol=-1, $sFont='-16,0,0,0,400,False,False,False,1,0,0,0,0,Arial')
    If _CheckToFormatted($iItem, $iSubItem) Then _SubItemColOff($iItem, $iSubItem)
    Local $Bk, $Col
    If $iBkCol = -1 Then $iBkCol = $defBkColLV
    If $iCol = -1 Then $iCol = $defColLV
    If $aSubItemSet[0][0] <> -1 Then ReDim $aSubItemSet[UBound($aSubItemSet)+1][5]
    $aSubItemSet[UBound($aSubItemSet)-1][0] = $iItem
    $aSubItemSet[UBound($aSubItemSet)-1][1] = $iSubItem
    $aSubItemSet[UBound($aSubItemSet)-1][2] = $iBkCol
    $aSubItemSet[UBound($aSubItemSet)-1][3] = $iCol
    $aSubItemSet[UBound($aSubItemSet)-1][4] = $sFont
    _WinAPI_InvalidateRect($hListView)
EndFunc  ;==>_SubItemColSet

Func _CheckToFormatted($iItem, $iSubItem)
    Local $aItemFound = _ArrayFindAll($aSubItemSet, $iItem)
    If @error Then Return False
    For $i = 0 To UBound($aItemFound) -1
        If $aSubItemSet[$aItemFound[$i]][1] = $iSubItem Then Return True
    Next
    Return False
EndFunc  ;==>_CheckToFormatted


Func _SubItemColOff($iItem, $iSubItem)
    Local $indx=-1
    Local $aIndex = _ArrayFindAll($aSubItemSet, $iItem)
    If @error Then Return
    For $i = 0 To UBound($aIndex) -1
        If $aSubItemSet[$aIndex[$i]][1] = $iSubitem Then
            $indx = $aIndex[$i]
            ExitLoop
        EndIf
    Next
    If $indx = -1 Then Return
    If UBound($aSubItemSet) > 1 Then
        _ArrayDelete($aSubItemSet, $indx)
    Else
        $aSubItemSet[0][0] = -1
        $aSubItemSet[0][1] = 0
        $aSubItemSet[0][2] = 0
        $aSubItemSet[0][3] = 0
        $aSubItemSet[0][4] = 0
    EndIf
    _WinAPI_InvalidateRect($hListView)
EndFunc  ;==>_SubItemColOff


Func _OneRowSetCol($iIndex, $iBkCol=-1, $iCol=-1)
    If $iBkCol = -1 Then $iBkCol = $defBkColLV
    If $iCol = -1 Then $iCol = $defColLV
    $aSubItemSet[0][0] = -1
    $aSubItemSet[0][1] = -3
    $aSubItemSet[0][2] = $iBkCol
    $aSubItemSet[0][3] = $iCol
    $aSubItemSet[0][4] = $iIndex
    _WinAPI_InvalidateRect($hListView)
    ;GUICtrlSetState($lbActiv, $GUI_SHOW)
EndFunc  ;==>_OneRowSetCol

at first I am changing the deafult font to bigger value. so it looks like this:

see Jpeg1.

second I am changing the item (1,5) line 1 - colum 5. but this changes everything on line 0 why ?

Link to comment
Share on other sites

Hi,

there are two things:

- Why you set coloring inside a loop? It makes not sense. The coloration are available till you'll delete this.

- "but this changes everything on line 0 why ?"

See your code (comments are deleted):

While 1
    Call("erez")
    _SubItemColSet(1, 5, '0xFFEEEE', '0xFF0000', '16,400,Arial')
    sleep (5000)
     _OneRowSetCol(0) ; <== here you set first line again !
WEnd

But I see, you use the first example. It's better to use the last one (FormatSubItemLV_new.au3). Because set off does'nt need no longer.

Edited by BugFix

Best Regards BugFix  

Link to comment
Share on other sites

Hi,

there are two things:

- Why you set coloring inside a loop? It makes not sense. The coloration are available till you'll delete this.

- "but this changes everything on line 0 why ?"

See your code (comments are deleted):

While 1
    Call("erez")
    _SubItemColSet(1, 5, '0xFFEEEE', '0xFF0000', '16,400,Arial')
    sleep (5000)
     _OneRowSetCol(0) ; <== here you set first line again !
WEnd

But I see, you use the first example. It's better to use the last one (FormatSubItemLV_new.au3). Because set off does'nt need no longer.

I don't think that is the problem, because when erased that line it is still happening.

can you tell me where do I set the default font size and color ?

As you can see I have used the _OneRowSetCol(0) and there changed the font size to -16, and everywhere I saw _WinAPI_CreateFont changed it also, but for some reason the default font when changing something is changed to 14.

Link to comment
Share on other sites

OK, I'll see, if i can rebuild your constellation for testing. Your code is too mighty and, of course, impossible to run for me.

But I repeat my recommendation: Try the latest version I've posted.

Best Regards BugFix  

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...