mattfaust Posted September 18, 2010 Posted September 18, 2010 i have a situation where I need to create a selectable list with the items pulled from a excel file. I have created an array that holds the data but I dont know how to populate a list in a gui with that array. Could someone point me in the right direction? thanks
wakillon Posted September 18, 2010 Posted September 18, 2010 i have a situation where I need to create a selectable list with the items pulled from a excel file.I have created an array that holds the data but I dont know how to populate a list in a gui with that array.Could someone point me in the right direction?thanksSee help file for _GUICtrlListView_Create function ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Beege Posted September 18, 2010 Posted September 18, 2010 Also check out _GUICtrlListView_AddArray(). 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
mattfaust Posted September 18, 2010 Author Posted September 18, 2010 See help file for _GUICtrlListView_Create function ! Ive looked and I dont understand.do I need to add each item from the array to the list with _GUICtrlListView_AddItem?If I have a 1d array , isnt their a better way to set the listview to display that data.Basically what I have is an excel file, with 250 entries in column A that I want to display on a selectable list inside a gui, _ArrayDisplay($aArray1, "Vertical") shows me the data, but I cant seem to get it inside my Gui.I need the data to display and be selectable so that I can can pass the selected item form the list on to be used later
mattfaust Posted September 18, 2010 Author Posted September 18, 2010 Also check out _GUICtrlListView_AddArray().I was trying that last night, seem like the obvious choice for my goal however It kept giving me:C:\Program Files\AutoIt3\Include\GuiListView.au3 (520) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:and I never figured out why
mattfaust Posted September 23, 2010 Author Posted September 23, 2010 (edited) Any other ideas? I really need to figure this out and im not having alot of luck.If I do _ArrayDisplay($aArray1, "Vertical")It will display the data I need, in 1 vertical column with a index # on the left side.All I want to do is display the same array inside my GUI so I can select one of the items.The closest Ive been able to get is by running $ActiveJobs = GUICtrlCreateList("", 16, 40, 161, 253)_GUICtrlListView_AddArray($ActiveJobs, $aArray1)however it faults out with this message..: ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:Im not sure what it is telling me, the array holds 250 items - Is there a limit on how many I can show in a listview? Edited September 23, 2010 by mattfaust
ProgrammingBrain Posted September 25, 2010 Posted September 25, 2010 (edited) i made small example to explain to you more clearly about listview creation and add items this code will get columns info from Windows Task Mananger and will show it on its own gui columns feel free to ask if you still have any problem here you are expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> #Include <GuiTab.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $ListView = GUICtrlCreateListView("", 8, 8, 465, 417) $ListView_hwnd=GUICtrlGetHandle($ListView) _GUICtrlListView_SetColumnWidth($ListView, 0, 240) _GUICtrlListView_SetColumnWidth($ListView, 1, 60) _GUICtrlListView_SetColumnWidth($ListView, 2, 60) _GUICtrlListView_SetColumnWidth($ListView, 3, 80) $refresh = GUICtrlCreateButton("Refresh List", 488, 144, 113, 145) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Run (@WindowsDir& "\System32\taskmgr.exe" , "",@SW_HIDE); run windows task manager Sleep(1000) ;====== select processes tab in task manager $hwnd_tabs=ControlGetHandle ( "Windows Task Manager", "", "[CLASS:SysTabControl32; INSTANCE:1]") ; get SysTabControl handel _GUICtrlTab_SetCurSel($hwnd_tabs, 1) ; select processes tab $hwnd_listviewtask=ControlGetHandle ( "Windows Task Manager", "", "[CLASS:SysListView32; INSTANCE:1]") ; get SysListView handel $count=_GUICtrlListView_GetItemCount($hwnd_listviewtask); listview items count $columns_count=_GUICtrlListView_GetColumnCount($hwnd_listviewtask) For $i=1 To $columns_count ; to get columns header text and width $column_info=_GUICtrlListView_GetColumn($hwnd_listviewtask, $i-1) _GUICtrlListView_AddColumn($ListView_hwnd, $column_info[5], $column_info[4] +10 ) Next For $i=0 to $count ; set data $list=_GUICtrlListView_GetItemTextArray($hwnd_listviewtask,$i) _GUICtrlListView_AddItem($ListView_hwnd, $list[1]) For $a=2 To $list[0] _GUICtrlListView_AddSubItem($ListView_hwnd, $i, $list[$a],$a-1) Next Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $refresh _GUICtrlListView_DeleteAllItems($ListView_hwnd) For $i=0 to $count ; set data $list=_GUICtrlListView_GetItemTextArray($hwnd_listviewtask,$i) _GUICtrlListView_AddItem($ListView_hwnd, $list[1]) For $a=2 To $list[0] _GUICtrlListView_AddSubItem($ListView_hwnd, $i, $list[$a],$a-1) Next Next EndSwitch WEnd Edited September 25, 2010 by cobako
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