Jump to content

ListView SubItem


Recommended Posts

Hello AutoIt-Community,

I have a nasty Problem. First of let's show you some code, so you can better understand what I am talking about :)

This is my GUI:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 225, 225, 747, 172)
$ListView1 = GUICtrlCreateListView("Person|Number", 8, 8, 200, 165)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)

$ListView1_0 = GUICtrlCreateListViewItem("Peter|5234", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("Bob|1234", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("Sally|5466", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("Julia|7543*", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("Marc|9999", $ListView1)
$ListView1_5 = GUICtrlCreateListViewItem("Joe|4545", $ListView1)
$ListView1_6 = GUICtrlCreateListViewItem("Nathan|4404", $ListView1)

$Button1 = GUICtrlCreateButton("Get", 72, 192, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            for $index = 1 to _GUICtrlListView_GetItemCount($ListView1)
                $Name = _GUICtrlListView_GetItemText($ListView1, $index,1)
                If StringInStr($Name,'*') Then
                      GUICtrlSetColor(_GUICtrlListView_GetItemText($ListView1,$name,1), 0xff0000) ; Red
                    MsgBox(0,'found *',$Name)
                EndIf
            Next
    EndSwitch
WEnd

It contains a ListView with two Columns. The first column with names, the second with numbers.

Now u can see that one of the subitems numbers has a * (Asteriks) at the End. (In this Case: Julia)

I want every Row, where the SubItems text contains an Asteriks (*) to be marked red. (Mark the TextColor not the background!)

I know I can mark Items read like this:

GUICtrlSetColor($ListView1, 0xff0000) ; Red

But for some reason the columns text won't get marked red? :( 

I mean I need to specifiy the index... I have a logic fail in my code somewhere, but I can't find it. Can u help me? :o

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

Just use GUICtrlSetColor on the relevant items: :)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 225, 225, 747, 172)
$ListView1 = GUICtrlCreateListView("Person|Number", 8, 8, 200, 165)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)

$ListView1_0 = GUICtrlCreateListViewItem("Peter|5234*", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("Bob|1234", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("Sally|5466", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("Julia|7543*", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("Marc|9999", $ListView1)
$ListView1_5 = GUICtrlCreateListViewItem("Joe|4545", $ListView1)
$ListView1_6 = GUICtrlCreateListViewItem("Nathan|4404", $ListView1)
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For $i = 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
    If StringInStr( _GUICtrlListView_GetItemText($ListView1, $i, 1), "*") Then
        GUICtrlSetColor($ListView1_0 + $i, 0xFF0000)
    EndIf
Next
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$Button1 = GUICtrlCreateButton("Get", 72, 192, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            for $index = 0 to _GUICtrlListView_GetItemCount($ListView1) - 1 ; ListView items start at index 0 <<<<<<<<<<<<<<<<<<<<<<<<<
                $Name = _GUICtrlListView_GetItemText($ListView1, $index,1)
                If StringInStr($Name,'*') Then
                      GUICtrlSetColor(_GUICtrlListView_GetItemText($ListView1,$name,1), 0xff0000) ; Red
                    MsgBox(0,'found *',$Name)
                EndIf
            Next
    EndSwitch
WEnd
Note the change I made to the loop limits - try detecting the first * with the original limits and see what happens. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hey, awesome! Works! Thank you :)

But I won't just copy/paste, so I like to ask some questions to understand better :)

Can U explain this line:

GUICtrlSetColor($ListView1_0 + $i, 0xFF0000)

I don't understand why U specify the ListViewItem If its not sure which Item contains the * ?

It would be cool if you can explain that, so I understand it properly :)

Anyways, thanks for your help :D

Because, what to do if the number of ListView Items is unknown?

Edited by MadaraUchiha

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

 

I won't just copy/paste, so I like to ask some questions to understand better

Good for you! :thumbsup:

 

why U specify the ListViewItem If its not sure which Item contains the * ?

I have commented the code - does this explain better?

; Loop through all items in the ListView - starting at 0 and going on until the total less one
For $i = 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
    ; Read the text of the subitem and see if it contains a *
    If StringInStr( _GUICtrlListView_GetItemText($ListView1, $i, 1), "*") Then
        ; If it does then we colour the item - but we only know the index of the item, not its ControlID
        ; So we add the index to the ControlID of the first item - which is item index 0
        GUICtrlSetColor($ListView1_0 + $i, 0xFF0000)
    EndIf
Next
If hope that also covers how you deal with a unknown number of ListViewitems - as long as you have the ControlID of the first you can easily get the others. :)

To check your understanding, see if you can work out why this colours the correct items: ;)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 225, 225, 747, 172)
$ListView1 = GUICtrlCreateListView("Person|Number", 8, 8, 200, 165)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)

$iStart_Items = GUICtrlCreateDummy()
GUICtrlCreateListViewItem("Peter|5234*", $ListView1)
GUICtrlCreateListViewItem("Bob|1234", $ListView1)
GUICtrlCreateListViewItem("Sally|5466", $ListView1)
GUICtrlCreateListViewItem("Julia|7543*", $ListView1)
GUICtrlCreateListViewItem("Marc|9999", $ListView1)
GUICtrlCreateListViewItem("Joe|4545", $ListView1)
GUICtrlCreateListViewItem("Nathan|4404", $ListView1)

For $i = 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
    If StringInStr( _GUICtrlListView_GetItemText($ListView1, $i, 1), "*") Then
        GUICtrlSetColor($iStart_Items + $i + 1, 0xFF0000)
    EndIf
Next

$Button1 = GUICtrlCreateButton("Get", 72, 192, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            for $index = 1 to _GUICtrlListView_GetItemCount($ListView1)  ; ListView items start at index 0 <<<<<<<<<<<<<<<<<<<<<<<<<
                $Name = _GUICtrlListView_GetItemText($ListView1, $index,1)
                If StringInStr($Name,'*') Then
                      GUICtrlSetColor(_GUICtrlListView_GetItemText($ListView1,$name,1), 0xff0000) ; Red
                    MsgBox(0,'found *',$Name)
                EndIf
            Next
    EndSwitch
WEnd
Please ask again if you are still having problems. :)

M23

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hm, thanks for commenting.

But in my case it won't mark it red.

The number of listview items is unknown at beginning.

So after all items are listed I got the index and the text of the *-Item.

But it won't mark it...

$iStart_Items = GUICtrlCreateDummy()
    For $i = 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
        If StringInStr( _GUICtrlListView_GetItemText($ListView1, $i, 1), "*") Then
            GUICtrlSetColor($iStart_Items + $i + 1, 0xFF0000)
        EndIf
    Next
     for $index = 1 to _GUICtrlListView_GetItemCount($ListView)
                $Name = _GUICtrlListView_GetItemText($ListView1, $index,1)
                If StringInStr($Name,'*') Then
                      GUICtrlSetColor(_GUICtrlListView_GetItemText($ListView1,$name,1), 0xff0000) ; Red
                    MsgBox(0,'found *',$Name)
                EndIf
            Next

? I used your code...

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

Did you put the $iStart_Items = GUICtrlCreateDummy() line before the point where you started creating the ListView items? :huh:

I suggest you post the whole script (I presume it is based on the one I helped you with yesterday) so that I can see what is happening. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

No, I got the ID, I mean the Index of the Item to color.

Now, lets say, our ListView is called $ListView1 and the Index number is saved in $Index.

I only need to color the Items & SubItems Text in the ListView on Index $Index.

But how? :s

EDIT: My code, but not making the item red :c

; Mark Item Red

For $Index= 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
If StringInStr( _GUICtrlListView_GetItemText($ListView1, $Index, 1), "*") Then
MsgBox(0,'Index',$Index)
MsgBox(0,'SubItem Text',_GUICtrlListView_GetItemText($ListView1, $Index,1))
  GUICtrlSetColor(_GUICtrlListView_GetItemText($ListView1,$Index,1), 0xff0000) ; Red
EndIf
Next
Edited by MadaraUchiha

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

Where does this Index $Bot come from? :huh:

And you should have realised by now that using the "Bot" word is like a red rag to a bull around here. ;)

 

But how?

As I have already shown you in the scripts above - get a fixed ControlID (either the first listView item or a dummy created just beforehand) and add the index to it (+ 1 if you use the dummy). This works because AutoIt allocates ControlIDs in numerical order as follows:

Control          Index    ControlID

Dummy                     10 (for this example only - it could be any number)

ListViewItem_0   0        11 (Dummy + Index + 1 = 11)
ListViewItem_1   1        12 (Dummy + Index + 1 = 12)
ListViewItem_2   2        13 (Dummy + Index + 1 = 13)
ListViewItem_3   3        14 (Dummy + Index + 1 = 14)
...
ListViewItem_n   n        Dummy + Index + 1
Does that help? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

MadaraUchiha,

Where does this Index $Bot come from? :huh:

And you should have realised by now that using the "Bot" word is like a red rag to a bull around here. ;)

 

As I have already shown you in the scripts above - get a fixed ControlID (either the first listView item or a dummy created just beforehand) and add the index to it (+ 1 if you use the dummy). This works because AutoIt allocates ControlIDs in numerical order as follows:

Control          Index    ControlID

Dummy                     10 (for this example only - it could be any number)

ListViewItem_0   0        11 (Dummy + Index + 1 = 11)
ListViewItem_1   1        12 (Dummy + Index + 1 = 12)
ListViewItem_2   2        13 (Dummy + Index + 1 = 13)
ListViewItem_3   3        14 (Dummy + Index + 1 = 14)
...
ListViewItem_n   n        Dummy + Index + 1
Does that help? :huh:

M23

 

Thanks so far, no I am not making a Bot, I got messed up with all my stuff, sorry.

Ok, well: I know how to grab Index and SubItemtext, but I wonder why the Coloring routine won't work?

In your example it did, but in my code:

; Mark Item Red

For $Index= 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
If StringInStr( _GUICtrlListView_GetItemText($ListView1, $Index, 1), "*") Then
MsgBox(0,'Index',$Index)
MsgBox(0,'SubItem Text',_GUICtrlListView_GetItemText($ListView1, $Index,1))
  GUICtrlSetColor(_GUICtrlListView_GetItemText($ListView1,$Index,1), 0xff0000) ; Red
EndIf
Next

It won't?

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

Look at the ControlID parameter you are using in the GUICtrlSetColor call! You are using the subitem text while you actually need the ControlID - so it is hardly surprising that it does not work. :wacko:

I have tried explaining to the best of my ability how to get the ControlID of the ListView item from index of the item within the ListView - I cannot see how to make it any clearer. So I suggest you post the whole script and I will try and get it to work for you. Perhaps the penny will drop then. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

 

I need to set the ID of the SubItem

Exactly - and I explained how to get it from the item index in post #8. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

Post your code! :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

$iStart_Items = GUICtrlCreateDummy()
    For $i = 0 to _GUICtrlListView_GetItemCount($ListView1) - 1
        If StringInStr( _GUICtrlListView_GetItemText($ListView1) $i, 1), "*") Then
            GUICtrlSetColor($iStart_Items + $i + 1, 0xFF0000)
        EndIf
    Next
     for $index = 1 to _GUICtrlListView_GetItemCount($ListView1) 
                $Name = _GUICtrlListView_GetItemText($ListView1) $index,1)
                If StringInStr($Name,'*') Then
                    MsgBox(0,'',$iStart_Items + $index + 1)
                      GUICtrlSetColor($iStart_Items + $index + 1, 0xff0000) ; Red
                    MsgBox(0,'found *',$Name)
                EndIf
    Next

... here u go :)

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

So you expect me to write all the rest of the necessary code to get that to run? When it is probably something else in your script - like the way you fill the ListView - which is causing the problem in the first place? :huh:

Be reasonable - post the whole script. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thats not easy, because its a part of a big project...

But basiclly, I download the Data for the ListView from my Server, and Split the Data by ||| check my old thread for this: '?do=embed' frameborder='0' data-embedContent>>

Then the listview is filled and one of the numbers in the second column has a * at the end. Thats all. Now I like to mark this Persons ListView Entry Red.

And thats what we are talking about here =)

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

I have explained several times how to get the ControlID of a ListView item from its index within the ListView so that you can use it in the GUICtrlSetColor function and have provided a couple of example scripts to show how it works. I can only assume that if you cannot get it to work then there must be something else in your script which is preventing it working - perhaps you do not create the items in immediate succession, or there is some other explanation which I cannot guess. After all my crystal ball is not infallible. :wacko:

So without sight of the rest of your script you cannot reasonably expect me to offer any more help - and I am certainly not going to give any. Good luck with your endeavours - I am out of here. :bye:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

MadaraUchiha,

 

I see how you get the Control ID of the ListView Item but I can't see how u get it of the specified SubItem?

You cannot - the whole item is a single control and so you can only colour the whole row. If you want individual subitems coloured then you are into owner-drawn ListViews - I think BugFix posted one a while back if you search. :)

 

isn't it possible iwhtout a Dummy?

You could create an array which stored the index and ControlID of each item as it was created and then use that to determine the relationship - but it seems a bit of an overkill. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...