Fantastic Posted March 26, 2010 Share Posted March 26, 2010 (edited) While console gives the wanted output Listview is not correct whatever I tried. See example 2 expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> $Form1 = GUICreate("Example 1", 800, 600, -1, -1) $hListView = GUICtrlCreateListView("", 12, 12, 500, 500) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 200) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) For $i = 1 To 10 _GUICtrlListView_AddItem($hListView, $i) For $ii = 1 To 10 _GUICtrlListView_AddItem($hListView, $ii) ConsoleWrite($i & @TAB & $ii & @CRLF) Next Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch Sleep(10) WEnd $Form2 = GUICreate("Example 2", 800, 600, -1, -1) $hListView = GUICtrlCreateListView("", 12, 12, 500, 500) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 200) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_EnableGroupView($hListView) For $i = 1 To 10 _GUICtrlListView_InsertGroup($hListView, -1, $i, $i) For $ii = 1 To 10 _GUICtrlListView_AddItem($hListView, $ii) _GUICtrlListView_SetItemGroupID($hListView, $i - 1, $i) ConsoleWrite($i & @TAB & $ii & @CRLF) Next Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(10) WEnd Edited March 26, 2010 by Fantastic [u]My current project:[/u] [size="1"]A bootable USB[/size]Webpage:*http://mylittlesoft.blogspot.com/ Link to comment Share on other sites More sharing options...
BrettF Posted March 26, 2010 Share Posted March 26, 2010 Fantastic, You had some minor errors in your logic. See the correct example: expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> $Form1 = GUICreate("Example 1", 800, 600, -1, -1) $hListView = GUICtrlCreateListView("", 12, 12, 500, 500) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 200) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) For $i = 1 To 10 For $ii = 1 To 10 $idx = _GUICtrlListView_AddItem($hListView, $i) _GUICtrlListView_AddSubItem($hListView, $idx, $ii, 1) ConsoleWrite($i & @TAB & $ii & @CRLF) Next Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch Sleep(10) WEnd $Form2 = GUICreate("Example 2", 800, 600, -1, -1) $hListView = GUICtrlCreateListView("", 12, 12, 500, 500) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 200) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_EnableGroupView($hListView) For $i = 1 To 10 _GUICtrlListView_InsertGroup($hListView, -1, $i, $i) For $ii = 1 To 10 $idx = _GUICtrlListView_AddItem($hListView, $i) _GUICtrlListView_AddSubItem($hListView, $idx, $ii, 1) _GUICtrlListView_SetItemGroupID($hListView, $idx, $i) ConsoleWrite($i & @TAB & $ii & @CRLF) Next Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(10) WEnd Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Fantastic Posted March 26, 2010 Author Share Posted March 26, 2010 Thank you BrettF, I tried many combinations and I couldn't get it working [u]My current project:[/u] [size="1"]A bootable USB[/size]Webpage:*http://mylittlesoft.blogspot.com/ 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