Jump to content

ghenerl questions about GUICtrlCreateListViewItem and more


Recommended Posts

hi guys  

i try to understund is possible have inside of listview  the  item  with a foto  and ceckbox  and one row (the same) colored 

if i understend well (i hope )   with this instruction GUICtrlCreateListViewItem i can crete a listview  with colored 

like this script 

;https://autoit.de/index.php/Thread/84194-Alternativer-L%C3%B6sungsweg-GuiCtrlSetBkColor/?postID=673544#post673544
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <ListviewConstants.au3>
#include <array.au3>
#include <File.au3>

Global $aNames[1]
_FileReadToArray('Benutzer.txt', $aNames, $FRTA_NOCOUNT)

$hGui = GUICreate("LV-Items färben", 220, 400)
$listview = GUICtrlCreateListView("Name|Status|CtrlID", 10, 10, 210, 350, $LVS_REPORT)
For $i = 0 To UBound($aNames) - 1
    $iItem = GUICtrlCreateListViewItem($aNames[$i] & "|Offline", $listview)
    GUICtrlSetData($iItem, "||" & $iItem)
Next

;_GUICtrlListView_SetColumnWidth($listview, 0, 140)
;_GUICtrlListView_SetColumnWidth($listview, 1, 40)
;_GUICtrlListView_SetColumnWidth($listview, 2, 0) ;0 = unsichtbar
;_GUICtrlListView_RegisterSortCallBack($listview)


_RandomOnOff()

GUISetState(@SW_SHOW)

;GUICtrlSetColor(-1, 0x22C21F)
;GUICtrlSetColor(-1, 0xAA0000)

While 1

WEnd

Func _RandomOnOff()
    ;AdlibUnRegister("_RandomOnOff")
    _GUICtrlListView_BeginUpdate($listview)
    ;For $i = 0 To _GUICtrlListView_GetItemCount($listview) - 1
        $aItem = _GUICtrlListView_GetItemTextArray($listview, 1)
    ;   _ArrayDisplay($aItem)
        ;If IsArray($aItem) Then
            ;If Random(1, 3, 1) = 1 Then
            ;   GUICtrlSetData($aItem[3], "|Off")
                GUICtrlSetBkColor(8, 0xCCFFCC)
            ;Else
            ;   GUICtrlSetData($aItem[3], "|On")
            ;   GUICtrlSetBkColor($aItem[3], 0x22C21F)
            ;EndIf
        ;EndIf
    ;Next
;   If GUICtrlGetState($listview) = 1 Then
;       _GUICtrlListView_SortItems($listview, 0)
;       _GUICtrlListView_SortItems($listview, 1)
;   EndIf
    _GUICtrlListView_EndUpdate($listview)
    ;AdlibRegister("_RandomOnOff", Random(5000, 10000, 1))
EndFunc   ;==>_RandomOnOff

but  for insert a foto or pic i must use 

_GUICtrlListView_SetImageList  and  populate a  listview    with _GUICtrlListView_AddSubItem _GUICtrlListView_AddItem   ??

therfore or  you use a first solution or second solution 

i understund correct??  

 

Edited by faustf
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...