d0n Posted October 17, 2009 Posted October 17, 2009 I am trying to put some text in my listview, but the subitem just wont add for me, not sure why it works if i just use GUICtrlcreatelistviewitem Func List() $List = IniReadSection(@ScriptDir&"\list.ini", GUIctrlread($Combo1)) For $i = 1 to $List[0][0] _GUICtrlListView_AddItem($List1, $List[$i][0]) _GUICtrlListView_AddSubItem($List1, $i, "0", 1) _GUICtrlListView_AddSubItem($List1, 0, $List[$i][1], 2) ;GUICtrlCreateListViewItem($Skill_List[$i][0]&"|0|"&$Skill_List[$i][1], $List1) Next _GUICtrlListView_SetItemSelected($List1, 0) EndFunc
Beege Posted October 17, 2009 Posted October 17, 2009 I am trying to put some text in my listview, but the subitem just wont add for me, not sure why it works if i just use GUICtrlcreatelistviewitem Func List() $List = IniReadSection(@ScriptDir&"\list.ini", GUIctrlread($Combo1)) For $i = 1 to $List[0][0] _GUICtrlListView_AddItem($List1, $List[$i][0]) _GUICtrlListView_AddSubItem($List1, $i, "0", 1) _GUICtrlListView_AddSubItem($List1, 0, $List[$i][1], 2) ;GUICtrlCreateListViewItem($Skill_List[$i][0]&"|0|"&$Skill_List[$i][1], $List1) Next _GUICtrlListView_SetItemSelected($List1, 0) EndFunc Make sure you are using a handle: _GUICtrlListView_AddSubItem(GUICtrlGetHandle($List1), $i, "0", 1) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
d0n Posted October 17, 2009 Author Posted October 17, 2009 still doesn't work it works for Additem when i didn't use a handle tho O_o
Beege Posted October 17, 2009 Posted October 17, 2009 Is $List1 declared Global? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
Beege Posted October 17, 2009 Posted October 17, 2009 I don't know then. Post your entire script so I can see if theres something else missing. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
Authenticity Posted October 17, 2009 Posted October 17, 2009 _GUICtrlListView_AddItem($List1, $List[$i][0]) The return value is very important for subsequent call like _GUICtrlListView_AddSubItem() because it's expecting the index of the item you're referring to. In other words: Func List() $List = IniReadSection(@ScriptDir&"\list.ini", GUIctrlread($Combo1)) For $i = 1 to $List[0][0] $iIndex = _GUICtrlListView_AddItem($List1, $List[$i][0]) _GUICtrlListView_AddSubItem($List1, $iIndex , "0", 1) _GUICtrlListView_AddSubItem($List1, $iIndex, $List[$i][1], 2) ;GUICtrlCreateListViewItem($Skill_List[$i][0]&"|0|"&$Skill_List[$i][1], $List1) Next _GUICtrlListView_SetItemSelected($List1, 0) EndFunc The code snippet example from the help file doesn't reflect that but it's required. It's documented though.
d0n Posted October 17, 2009 Author Posted October 17, 2009 expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #Include <Array.au3> Global $SkillPoint, $List1 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 455, 454, 268, 114) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $List1 = GUICtrlCreateListView("1|3|2", 24, 104, 201, 279) _GUICtrlListView_SetColumnWidth(-1, 0, 90) _GUICtrlListView_SetColumnWidth(-1, 1, 55) _GUICtrlListView_SetColumnWidth(-1, 2, 45) GUISetState(@SW_SHOW) List() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(10) WEnd Func List() $List = IniReadSection(@ScriptDir&"\test.ini", "test") For $i = 1 to $List[0][0] _GUICtrlListView_AddItem($List1, $List[$i][0]) _GUICtrlListView_AddSubItem($List1, $i, "0", 1) _GUICtrlListView_AddSubItem($List1, $i, $List[$i][1], 2) ;GUICtrlCreateListViewItem($Skill_List[$i][0]&"|0|"&$Skill_List[$i][1], $List1) Next _GUICtrlListView_SetItemSelected($List1, 0) EndFunc The ini is just [test] apple=1 orange=2 banana=13
Beege Posted October 17, 2009 Posted October 17, 2009 what Authenticity said should be correct. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
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