Wingens Posted February 27, 2019 Share Posted February 27, 2019 Hi, I am not good with arrays what i want to create is a listview from the values in multiple sections. Every section is a colom in the list view. Below you find my code and my ini file. I got 3 inifiles the first I use to get some kind of unique ID-number, the other 2 are used to store vakantion and overtime information. Hope you guys can help me [VAN] 1=2019/02/27 4=2019/02/27 [TM] 1=2019/03/06 4=2019/03/02 [AANTAL] 1=6 4=3 [REDEN] 1=In mindering van beschikbare vakantie / snipperdagen 4=Zal worden ingehaald [OPMERKING] 1=Vakantie 4=bla expandcollapse popup$OverzichtGUI = GUICreate("Overzicht", 1189, 845, -1, -1, $WS_POPUPWINDOW) GUICtrlCreateGroup("Verlof Overzicht", 8, 8, 1169, 361) $VerlofListView = GUICtrlCreateListView("Van|Tot en met|Aantal Dagen|Reden|Opmerking", 16, 32, 1154, 294) $VerlofExport = GUICtrlCreateButton("Exporteren", 16, 336, 75, 25) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Overwerken Overzicht", 8, 377, 1169, 361) $OverwerkListView = GUICtrlCreateListView("Van|Tot en met|Aantal Dagen|Opmerking", 16, 400, 1154, 294) $OverwerkExport = GUICtrlCreateButton("Exporteren", 16, 704, 75, 25) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Totaal Overzicht", 8, 744, 345, 89) GUICtrlCreateLabel("Beginsaldo in dagen:", 16, 776, 103, 17) $Beginsaldo = GUICtrlCreateLabel("Beginsaldo", 128, 776, 42, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Eindsaldo in dagen:", 16, 800, 97, 17) $Eindsaldo = GUICtrlCreateLabel("Eindsaldo", 128, 800, 42, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Totaal verlof:", 200, 776, 66, 17) $TotaalVerlof = GUICtrlCreateLabel("Totaalverlof", 296, 776, 42, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel("Totaal overuren:", 200, 800, 82, 17) $TotaalOverwerk = GUICtrlCreateLabel("Totaaloverwerk", 296, 800, 42, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Sluiten = GUICtrlCreateButton("Sluiten", 1096, 776, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Sluiten Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Subz Posted February 27, 2019 Share Posted February 27, 2019 (edited) Try something like: #include <Array.au3> #include <GuiListView.au3> Local $sIniFile1 = @ScriptDir & "\Filename.ini" ;~ Get list of Section Names Local $aSectionNames1 = IniReadSectionNames($sIniFile1) If @error Then Exit MsgBox(4096, "Error", "Error reading Section Names") ;~ Use the first section as template Local $aSection1 = IniReadSection($sIniFile1, $aSectionNames1[1]) If @error Then Exit MsgBox(4096, "Error", "Error reading first section") ;~ Build the Listview Array Local $aListView[$aSection1[0][0]][$aSectionNames1[0]] For $i = 1 To $aSection1[0][0] For $j = 1 To $aSectionNames1[0] $aListView[$i - 1][$j - 1] = IniRead($sIniFile1, $aSectionNames1[$j], $aSection1[$i][0], "") Next Next _ArrayDisplay($aListView) ;~ In your gui just add the following to create your Listview from the Array you created above Local $idVerlofListView = GUICtrlCreateListView(_ArrayToString($aSectionNames1, "|", 1), 16, 32, 1154, 294) _GUICtrlListView_AddArray ($idVerlofListView, $aListView) Edited February 27, 2019 by Subz Link to comment Share on other sites More sharing options...
Wingens Posted February 28, 2019 Author Share Posted February 28, 2019 Thanks just added the code and it's working. Link to comment Share on other sites More sharing options...
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