How to specify the color of the most recently added row in a ListView

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JoeWinograd
Posts: 2202
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

How to specify the color of the most recently added row in a ListView

22 Feb 2016, 10:50

I'm using a ListView as a way of implementing a "Processing Console" for an app (and also saving it as a Logfile). The code is very simple:

Code: Select all

RowNumber:=LV_Add("",LogfileRecord) ; write record to Processing Console
LV_Modify(RowNumber,"Vis") ; scroll LV so newly added last row is visible
That works fine, but here's the problem. The output in the LV should be in red if the first character of the record is an asterisk, otherwise in green. I thought this code before the LV_Add and LV_Modify would do the trick:

Code: Select all

If (SubStr(LogfileRecord,1,1)="*")
{
  Gui,Font,bold s10 cFF0000,Arial
  GuiControl,Font,LogfileListView
}
Else
{
  Gui,Font,bold s10 c00FF00,Arial
  GuiControl,Font,LogfileListView
}
But that doesn't work — it changes all of the rows in the LV to red or green. How can I specify the color of only the most recently added row? Thanks much, Joe
listview-or-box

Re: How to specify the color of the most recently added row in a ListView

22 Feb 2016, 10:54

Google for

[Class] LV_Colors autohotkey

and you'll find a class by Just me which can do what you want (color text and/or the background color)
User avatar
kczx3
Posts: 1644
Joined: 06 Oct 2015, 21:39

Re: How to specify the color of the most recently added row in a ListView

22 Feb 2016, 11:48

Everyone should just bookmark this link in their web browser. https://github.com/AHK-just-me
User avatar
JoeWinograd
Posts: 2202
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How to specify the color of the most recently added row in a ListView

22 Feb 2016, 12:00

Thanks to both of you — I'll check it out.

Update on 8-March: Thanks again to both of you for pointing me to LV_Colors. It is the perfect solution — works great! Regards, Joe

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], cinematic6436, jjaysreicarnten, mikeyww and 301 guests