Cusem Posted July 23, 2009 Posted July 23, 2009 I'm having some trouble figuring out the following: I have a listview that consists of 10 columns. In column 8, 9 and 10 I want an image to be displayed. Everything works out, except one issue and the minor problem that I don't want an image to be displayed in the first column (which is populated by _GUICtrlListView_AddItem), but only on subitems 8, 9 and 10 (which are populated by _GUICtrlListView_AddSubItem). If I set -1 at the $iImage parameter at _GuiCtrlListView_AddItem, it still displays an image from the imagelist. But this isn't my main problem (although a solution would be nice), since I figure this is overcomeable by populating the _GUICtrlListView_AddItem() to a column with columwidth = 0, rendering it invisible and start populating in SubItems after that. The main problem is that column 8 is supposed to display a 5-star rating and column 9 and 10 are supposed to display a single icon with the usual text alongside. I managed the 5 star rating by creating 5 BMP's in photoshop, each with representing star-rating (1 through 5). I use $hImage = GuiImageList_Create(65, 13) and with the code below the rating system displays well. The problem is, I don't want the icons for column 9 and 10 to be 65 wide, but 13. I tried working with 2 imagelists, but this didn't work out and I looked into _GUICtrlListView_SetItemStateImage(GUICtrlGetHandle($LV_Main), $b, 1), but also with no succes. Does anybody have a solution? Or maybe know if and how it's possible to repeat icons in the same subitem? The listview is populated from an array with the following code (not with _GuiCtrlListView_AddArray because I can't get _GuiCtrlListView_SortItems to work with the AddArray function) expandcollapse popupLocal $sz = $GUIMain_Width - 200 & "x" & $GUIMain_Height - 170 Local $hLV = GUICtrlGetHandle($LV_Main) If _GUICtrlListView_InsertColumn($hLV, 0, $aHeaders_Main[1], 68, 2) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 1, $aHeaders_Main[2], LV_ColumnWidth($sz, 10, 75)) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 2, $aHeaders_Main[3], LV_ColumnWidth($sz, 10, 70)) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 3, $aHeaders_Main[4], LV_ColumnWidth($sz, 10, 70)) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 4, $aHeaders_Main[5], LV_ColumnWidth($sz, 15, 10)) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 5, $aHeaders_Main[6], LV_ColumnWidth($sz, 20, 10)) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 6, $aHeaders_Main[7], LV_ColumnWidth($sz, 35, 10)) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 7, $aHeaders_Main[8], 40, 2) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 8, $aHeaders_Main[9], 65) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 9, $aHeaders_Main[10], 40, 2) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 10, $aHeaders_Main[11], 40, 2) = -1 Then $rr += 1 If _GUICtrlListView_InsertColumn($hLV, 11, "ID", 0) = -1 Then $rr += 1 If $rr > 0 Then __Error("0x00AA30", $rr) For $a = 1 To UBound($aDBMain) Local $aa = $a - 1 _GUICtrlListView_AddItem($hLV, Format_Date($aDBMain[$aa][0], "listview"), 0, $aDBMain[$aa][UBound($aDBMain, 2) - 1]) For $b = 1 To UBound($aDBMain, 2) - 1 Local $img = -1 Local $bb = $b + 1 If $bb > UBound($aDBMain, 2) - 1 Then $bb = UBound($aDBMain, 2) - 1 If $aHeaders_Main[$bb] = "Rating" Then Select Case StringLen($aDBMain[$aa][$b]) = 5 $img = 4 Case StringLen($aDBMain[$aa][$b]) = 4 $img = 3 Case StringLen($aDBMain[$aa][$b]) = 3 $img = 2 Case StringLen($aDBMain[$aa][$b]) = 2 $img = 1 Case StringLen($aDBMain[$aa][$b]) = 1 $img = 0 EndSelect $img = 0 EndIf _GUICtrlListView_AddSubItem($hLV, $aa, $aDBMain[$aa][$b], $b, $img) Next Next
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