Jewtus Posted October 9, 2014 Share Posted October 9, 2014 I'm trying to make it so anything in a row that has a specific column 5 value will show up with red font. Here is a small snippet. For $z = 0 To (UBound($MetadataDB2)) - 1 _GUICtrlListView_AddItem($FoundAccountBox, $MetadataDB2[$z][5], 0) _GUICtrlListView_AddSubItem($FoundAccountBox, $z, $MetadataDB2[$z][0], 1, 1) _GUICtrlListView_AddSubItem($FoundAccountBox, $z, $MetadataDB2[$z][1] & " to " & $MetadataDB2[$z][2], 2, 2) _GUICtrlListView_AddSubItem($FoundAccountBox, $z, $MetadataDB2[$z][3], 3, 3) If $MetadataDB2[$z][5] <> 0 Then MsgBox(0,"","COLOR CHANGE DAMNIT"&@CRLF&$MetadataDB2[$z][5]) EndIf Next The message box kicks up for ever time the field is blank, but I don't really know what command will change just a single rows font color. I've been looking at this article: '?do=embed' frameborder='0' data-embedContent>> But I cannot seem to figure out how to actually change the font color... Anyone have tips? Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted October 9, 2014 Moderators Solution Share Posted October 9, 2014 Jewtus,As you want to colour the whole line I would do it using the native functions rather than the UDF: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("Col 0 |Col 1 |Col 2 |Col 3 |Col 4 ", 10, 10, 400, 200) For $i = 0 To 20 $iItem_0 = Random(0, 5, 1) $iItem_1 = Random(0, 5, 1) $iItem_2 = Random(0, 5, 1) $iItem_3 = Random(0, 5, 1) $iItem_4 = Random(0, 1, 1) GUICtrlCreateListViewItem($iItem_0 & "|" & $iItem_1 & "|" & $iItem_2 & "|" & $iItem_3 & "|" & $iItem_4, $cLV) If $iItem_4 <> 0 Then GUICtrlSetColor(-1, 0xFF0000) ; Colour line if final item in not 0 EndIf Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Jewtus Posted October 9, 2014 Author Share Posted October 9, 2014 Jewtus, As you want to colour the whole line I would do it using the native functions rather than the UDF: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("Col 0 |Col 1 |Col 2 |Col 3 |Col 4 ", 10, 10, 400, 200) For $i = 0 To 20 $iItem_0 = Random(0, 5, 1) $iItem_1 = Random(0, 5, 1) $iItem_2 = Random(0, 5, 1) $iItem_3 = Random(0, 5, 1) $iItem_4 = Random(0, 1, 1) GUICtrlCreateListViewItem($iItem_0 & "|" & $iItem_1 & "|" & $iItem_2 & "|" & $iItem_3 & "|" & $iItem_4, $cLV) If $iItem_4 <> 0 Then GUICtrlSetColor(-1, 0xFF0000) ; Colour line if final item in not 0 EndIf Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M23 AWESOME! That is exactly what I needed. I also had no idea that GUICtrlCreateListViewItem would do the function that way... I have those stupid add sub item commands on every list view box!!!! Looks like I got some code to rewrite. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 9, 2014 Moderators Share Posted October 9, 2014 Jewtus, Looks like I got some code to rewriteSorry about that. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mikell Posted October 9, 2014 Share Posted October 9, 2014 (edited) The udfs are nice but their usual use often leads to forget many easy-to-use integrated funcs Edited October 9, 2014 by mikell Link to comment Share on other sites More sharing options...
Adele Posted February 14, 2015 Share Posted February 14, 2015 (edited) Can we change color of the specified item without use the value returning from GuiCtrlCreateListViewItem()? Edited February 14, 2015 by Adele Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now