pootie tang Posted July 27, 2006 Posted July 27, 2006 (edited) I have a listview (2 columns) which I want to from time to time change the text in 1 given item in column #2. For example, Column 1.................................................................Column2 My description...........................................................Initial Value (in black) after the change My description............................................................New Value (in red) All other data in the listview (include font color should remains as is). Any help would be appreicated. On a different note, I have asked the moderators to change my id (to remove confusion with others) ... have not heard back yet. Dave Edited July 27, 2006 by bigdaddy
Moderators big_daddy Posted July 28, 2006 Moderators Posted July 28, 2006 This should give you an idea. #include <GuiConstants.au3> #include <GuiListView.au3> $GUI = GUICreate("Test") $List = GUICtrlCreateListView("Column 1|Column 2", _ 10, 10, 380, 380, -1, $LVS_EX_FULLROWSELECT) _GUICtrlListViewSetColumnWidth($List, 0, 190) _GUICtrlListViewSetColumnWidth($List, 1, 190) GUISetState() For $i = 1 To 20 GUICtrlCreateListViewItem("My description " & $i & "|" & "Initial Value " & $i, $List) If $i = 5 Then GUICtrlSetColor(-1, 0x0000FF) ElseIf $i = 10 Then GUICtrlSetColor(-1, 0xFF0000) EndIf Next While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd p.s. The only mod around right now is jpm. Larry and JdeB are both on vacation.
Moderators SmOke_N Posted July 28, 2006 Moderators Posted July 28, 2006 Only Jon can change the name anyway... PM him. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
pootie tang Posted July 28, 2006 Author Posted July 28, 2006 This should give you an idea. #include <GuiConstants.au3> #include <GuiListView.au3> $GUI = GUICreate("Test") $List = GUICtrlCreateListView("Column 1|Column 2", _ 10, 10, 380, 380, -1, $LVS_EX_FULLROWSELECT) _GUICtrlListViewSetColumnWidth($List, 0, 190) _GUICtrlListViewSetColumnWidth($List, 1, 190) GUISetState() For $i = 1 To 20 GUICtrlCreateListViewItem("My description " & $i & "|" & "Initial Value " & $i, $List) If $i = 5 Then GUICtrlSetColor(-1, 0x0000FF) ElseIf $i = 10 Then GUICtrlSetColor(-1, 0xFF0000) EndIf Next While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd p.s. The only mod around right now is jpm. Larry and JdeB are both on vacation. Thanks ... I'll give it a shot ... I already PM'ed Jon ... haven't heard back yet Regards, Dave
pootie tang Posted July 31, 2006 Author Posted July 31, 2006 This should give you an idea. #include <GuiConstants.au3> #include <GuiListView.au3> $GUI = GUICreate("Test") $List = GUICtrlCreateListView("Column 1|Column 2", _ 10, 10, 380, 380, -1, $LVS_EX_FULLROWSELECT) _GUICtrlListViewSetColumnWidth($List, 0, 190) _GUICtrlListViewSetColumnWidth($List, 1, 190) GUISetState() For $i = 1 To 20 GUICtrlCreateListViewItem("My description " & $i & "|" & "Initial Value " & $i, $List) If $i = 5 Then GUICtrlSetColor(-1, 0x0000FF) ElseIf $i = 10 Then GUICtrlSetColor(-1, 0xFF0000) EndIf Next While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd p.s. The only mod around right now is jpm. Larry and JdeB are both on vacation. I gave it a shot ... worked perfectly. The only issue I ran into was if another window covered my window and then went away, the colors where lost. As long as another window didn't cover my window, it was ok. Any thoughts? Thanks. Dave p.s. id has been changed to pootie tang
livewire Posted August 6, 2006 Posted August 6, 2006 Is there any way to set color based on index (not ControlID)?
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