Jump to content
Sign in to follow this  
fett8802

Question about ListViews

Recommended Posts

fett8802

At the risk of getting yelled at, I'm going to go ahead and ask my question. Let it be known that I've spent the last two work hours searching for an answer here and at google. (I really hate that most forum posts these days begin with "I'm sorry, don't yell at me but...") I haven't been able to find anything that could directly explain this. I found some UDF (supposedly) files here that were simply GUI's that I couldn't include. Here's the question:

I'm working on a program that will program certain aspects of my jobs electronic panels. This is done over a TCP connection to the panel. Everything works fine and dandy. At the bottom of the GUI, I have a ListView that I use as a diagnostics screen; it reports all connection information, packets, and all that stuff; and is constantly updating. It also reports any errors that come across.

Now, what I'd like to have happen is that any time the program errors, the text come across in the ListView red; so that I can easily scroll through the diagnostics and recognize any errors. Now, I've tried all the different functions and they ALL change the entire ListView. I'm really shocked that AutoIt is missing something as intuitive and simple as a function to simply color one added ListView item.

Is there any relatively simple way to achieve this? (And if not, why the heck not?)

Thanks for you help,

Fett


[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites
AdmiralAlkex

That wasn't very hard, got it on my first try:

GUICreate("test", 640, 480)
$listview = GUICtrlCreateListView("something", 5, 5, 200, 200)
GUICtrlCreateListViewItem("test1", $listview)
GUICtrlCreateListViewItem("test2", $listview)
GUICtrlSetColor(-3, 0xFF0000)
GUICtrlSetBkColor(-3, 0x0000FF)
GUICtrlCreateListViewItem("test3", $listview)

GUISetState()

Do
Until GUIGetMsg() = -3

Share this post


Link to post
Share on other sites
fett8802

Here's an example of some of the code I have. I can't post much, as it's considered proprietary.

_GUICtrlListView_AddItem($Diagnostics,$Diag_Item_Number)
            _GUICtrlListView_AddSubItem($Diagnostics, $Diag_Item_Number - 1, @HOUR & ":" & @MIN & ":" & @SEC, 0)
                _GUICtrlListView_AddSubItem($Diagnostics, $Diag_Item_Number - 1, "In", 1)
                    _GUICtrlListView_AddSubItem($Diagnostics, $Diag_Item_Number - 1, "Version", 2)
                        _GUICtrlListView_AddSubItem($Diagnostics, $Diag_Item_Number - 1, $Panel_Version, 3)
                            If $PVRL = 500 Then
                                ;If $Color_Diagnostics = 1 Then
                                    ;GUICtrlSetColor($Diagnostics, 0xFF0000)
                                ;EndIf
                                _GUICtrlListView_AddSubItem($Diagnostics, $Diag_Item_Number - 1, "Version Response Failed -- Connection Ended", 4)
                                _GUICtrlStatusBar_SetText($StatusBar1, "Communication Status: Connection Ended", 0)
                                ;GUICtrlSetColor($Diagnostics, 0x000000)
                            Else
                            _GUICtrlListView_AddSubItem($Diagnostics, $Diag_Item_Number - 1, $Panel_Version_Response, 4)
                            EndIf
                                _GUICtrlListView_Scroll($Diagnostics, 0, 16)

Where the $PVRL = 500 is the TCP timeout. So, it writes the same first half every time and write the last half if the timeout occurs. Also, the $Diag_Item_Number increases every post. And here's a screen shot of the Diagnostics portion. Sorry about having to black out some of the information.

Edited by fett8802

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites
KaFu

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  

×