kor Posted March 23, 2011 Share Posted March 23, 2011 I am attempting to have my GUI look functionally similar to my attached screenshot. I need to create a list view (I think this GUI type is a list view) that will populate based on an AD query of groups matching a specific critiera. The AD Get groups functions I'm sure I can figure out. The question I have is how to populate the tree view based on the output of the AD query since the number and names of the groups will always be dynamic. I also need the ability to select multiple groups as seen in the screen shot. then when I click ok or add or whatever I call the button, it will take my selections and store them in an array. Can anyone tell me what kind of gui items im going to need to get started? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor, You are correct - it is a ListView control. how to populate the tree view [...] since the number [...] will always be dynamicUse a For...Next loop and create a row (or Item as it is called) for each entry. the ability to select multiple groupsDo not include the $LVS_SINGLESEL style. take my selections and store them in an arrayTake a look at _GUICtrlListView_GetSelectedIndices and _GUICtrlListView_GetItemText in the Help file. Anything else? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 23, 2011 Author Share Posted March 23, 2011 expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Global $hListView _Main() Func _Main() Local $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) GUISetState() ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Name (RDN)", 300) ; Add items _GUICtrlListView_AddItem($hListView, "testing a long group description", 0) _GUICtrlListView_AddItem($hListView, "another test group", 0) _GUICtrlListView_AddItem($hListView, "a big long name of a test group", 0) _GUICtrlListView_AddItem($hListView, "another test group of similar name", 0) _GUICtrlListView_AddItem($hListView, "short group name", 0) _GUICtrlListView_AddItem($hListView, "even shorter", 0) guictrlcreatebutton("add", 200, 275, 80, 20) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Having trouble figuring out the multiple selection thing. I see the style in the helpfile, but I dont know how NOT to include it since it seems its included by default. I'll play with the loop of dynamic content last. First I want to get the gui sorted, then I can figure out how to fill it Link to comment Share on other sites More sharing options...
BrewManNH Posted March 23, 2011 Share Posted March 23, 2011 You have to create the listview with the native AutoIt GUICtrlCreateListView command and set the styles manually, you can't include $GUI_SS_DEFAULT_LISTVIEW because the default style includes the SingleSel style. Just set the styles you want for the listview and don't include the styles you don't want and it should work ok. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor,Having trouble figuring out the multiple selection thing. I see the style in the helpfile, but I dont know how NOT to include it since it seems its included by default.Might I suggest the Setting Styles tutorial in the Wiki - I wrote it to explain exactly how to get over this problem. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 23, 2011 Author Share Posted March 23, 2011 As soon as I apply $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268, BitOR($LVS_LIST, $LVS_SORTASCENDING)) My column header goes away ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Name (RDN)", 300) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor,You should be using the $LVS_REPORT style to get the kind of ListView you are looking for, not $LVS_LIST. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 23, 2011 Author Share Posted March 23, 2011 Code so far. I am using a test array until I can work out the AD get objects function. I am having a problem though in how do I read multiple selections? When I click on the value button it only gives me the first item I've selected instead of all of them. I'm also wondering if this listview adds the | at the end of each selection item by default? IE (item1|) (item2|) expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Dim $array[4] $array[0] = "name1" $array[1] = "name2" $array[2] = "name3" $array[3] = "name4" Example() Func Example() Local $listview, $button, $msg GUICreate("listview items", 220, 250) $listview = GUICtrlCreateListView("test column ", 10, 10, 200, 150, $LVS_REPORT) $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20) For $i = 0 To UBound($array) - 1 GUICtrlCreateListViewItem($array[$i], $listview) Next GUISetState() Do $msg = GUIGetMsg() Select Case $msg = $button MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview))) Case $msg = $listview MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2) EndSelect Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor,Do you actually read the replies you get? I suggested _GUICtrlListView_GetSelectedIndices and _GUICtrlListView_GetItemText, yet here you are trying to use GUICtrlRead. Furthermore you started off using the UDF-created ListView, which is advisable if you want to use the UDF functions and now you have switched to the native-created version. Any particular reason? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 23, 2011 Author Share Posted March 23, 2011 (edited) I have read the replies. The UDF way of doing things was harder for me to understand. But I've reworked my old example to get to the same spot I am at from the other code. expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Global $hListView Dim $array[4] $array[0] = "name1" $array[1] = "name2" $array[2] = "name3" $array[3] = "name4" _Main() Func _Main() Local $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268, BitOR($LVS_REPORT, $LVS_SORTASCENDING, $LVS_NOSORTHEADER)) GUISetState() ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Name (RDN)", 300) ; Add items For $i = 0 To UBound($array) - 1 _GUICtrlListView_AddItem($hListView, $array[$i]) Next $button = guictrlcreatebutton("add", 200, 275, 80, 20) ; Loop until user exits Do $msg = GUIGetMsg() Select Case $msg = $button $1 = _GUICtrlListView_GetSelectedIndices($hListView, True) _ArrayDisplay($1) Case $msg = $hListView MsgBox(0, "listview", "clicked=" & GUICtrlGetState($hListView), 2) EndSelect Until $msg = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main I still don't know how to read multiple selections. I've looked at the getindicies, but it returns a number. Edited March 23, 2011 by kor Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor, I've looked at the getindicies, but it returns a numberIt actually returns an array of the indices selected, which your code displays. So, as I also suggested, you use a For...Next loop with _GUICtrlListView_GetItemText to go the next step: Case $msg = $button $1 = _GUICtrlListView_GetSelectedIndices($hListView, True) For $i = 1 To $1[0] ConsoleWrite(_GUICtrlListView_GetItemText($hListView, $1[$i]) & @CRLF) Next All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 23, 2011 Author Share Posted March 23, 2011 (edited) Is clear now. Thank you. I figured it would take another loop to read the selections. EDIT: How would your code look if you were using the array call _GUICtrlListView_GetItemTextArray?? Having the selections in an array will make them much easier to deal with later down the road. Edited March 23, 2011 by kor Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor, How would your code look if you were using the array call _GUICtrlListView_GetItemTextArray??Have you tried? The array you get is an array of thetext in the item and all sub-items in the same row - so it would not help you much. You will have to create an array and then put the returns from _GUICtrlListView_GetItemText into the elements. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 24, 2011 Author Share Posted March 24, 2011 Final step is injecting the 2 loops into each other. Please see code. Also, if anyone can tell me how I might go about getting rid of group names using StringRegExp or something similar instead of having to name each group individually that would be great. Code to give me an array of all groups in AD #include <ad.au3> #include <array.au3> _AD_Open() Global $list[10] $list[0] = "Account Operators" $list[1] = "Administrators" $list[2] = "Backup Operators" $list[3] = "Allowed RODC Password Replication Group" $list[4] = "Cert Publishers" $list[5] = "Certificate Service DCOM Access" $list[6] = "Cryptographic Operators" $list[7] = "Delegated Setup" $list[8] = "Denied RODC Password Replication Group" $list[9] = "DHCP Users" $var = _AD_GetObjectsInOU("", "(objectcategory=group)", 2) For $i = Ubound($var) - 1 to 0 Step - 1 For $n = 0 to UBound($list) -1 If StringInStr($var[$i], $list[$n]) then _ArrayDelete($var, $i) EndIf Next Next _AD_Close() Code to create list gui expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Global $hListView Dim $array[4] $array[0] = "name1" $array[1] = "name2" $array[2] = "name3" $array[3] = "name4" _Main() Func _Main() Local $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268, BitOR($LVS_REPORT, $LVS_SORTASCENDING, $LVS_NOSORTHEADER)) GUISetState() ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Name (RDN)", 300) ; Add items For $i = 0 To UBound($array) - 1 _GUICtrlListView_AddItem($hListView, $array[$i]) Next $button = guictrlcreatebutton("add", 200, 275, 80, 20) ; Loop until user exits Do $msg = GUIGetMsg() Select Case $msg = $button $1 = _GUICtrlListView_GetSelectedIndices($hListView, True) For $i = 1 To $1[0] ConsoleWrite(_GUICtrlListView_GetItemText($hListView, $1[$i]) & @CRLF) Next EndSelect Until $msg = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main I need to somehow combine the array output of all the groups, into the loop that creates each list item. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 24, 2011 Moderators Share Posted March 24, 2011 kor,Please post an example of the return you get from your _AD_GetObjectsInOU call (sanitised if necessary) and I will take a look. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
BrewManNH Posted March 24, 2011 Share Posted March 24, 2011 Put the 2 scripts together with the second script after the first one, making sure that all of your global declarations, and ALL of your #include statements are at the start of the script. Second just change the lines here: ; Add items For $i = 0 To UBound($array) - 1 _GUICtrlListView_AddItem($hListView, $array[$i]) Next To this: ; Add items For $i = 0 To UBound($var) - 1 _GUICtrlListView_AddItem($hListView, $var[$i]) Next And that should populate the ListView If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
kor Posted March 24, 2011 Author Share Posted March 24, 2011 using code expandcollapse popup#include <ad.au3> #include <array.au3> _AD_Open() Global $list[50] $list[0] = "Account Operators" $list[1] = "Administrators" $list[2] = "Backup Operators" $list[3] = "$F51000-LP7DJ67UIARD" $list[4] = "Allowed RODC Password Replication Group" $list[5] = "Cert Publishers" $list[6] = "Certificate Service DCOM Access" $list[7] = "Cryptographic Operators" $list[8] = "Delegated Setup" $list[9] = "Denied RODC Password Replication Group" $list[10] = "DHCP Users" $list[11] = "Discovery Management" $list[12] = "Distributed COM Users" $list[13] = "DnsAdmins" $list[14] = "DnsUpdateProxy" $list[15] = "Domain Admins" $list[16] = "Domain Computers" $list[17] = "Domain Controllers" $list[18] = "Domain Guests" $list[19] = "Domain Users" $list[20] = "Enterprise Admins" $list[21] = "Enterprise Read-only Domain Controllers" $list[22] = "Event Log Readers" $list[23] = "Exchange All Hosted Organizations" $list[24] = "Exchange Servers" $list[25] = "Exchange Trusted Subsystem" $list[26] = "Exchange Windows Permissions" $list[27] = "ExchangeLegacyInterop" $list[28] = "Guests" $list[29] = "Help Desk" $list[30] = "Hygiene Management" $list[31] = "IIS_IUSRS" $list[32] = "Incoming Forest Trust Builders" $list[33] = "Network Configuration Operators" $list[34] = "Performance Log Users" $list[35] = "Performance Monitor Users" $list[36] = "Pre-Windows 2000 Compatible Access" $list[37] = "Public Folder Management" $list[38] = "RAS and IAS Servers" $list[39] = "Read-only Domain Controllers" $list[40] = "Recipient Management" $list[41] = "Records Management" $list[42] = "Replicator" $list[43] = "Schema Admins" $list[44] = "Server Management" $list[45] = "Server Operators" $list[46] = "Storage Servers" $list[47] = "Terminal Server License Servers" $list[48] = "UM Management" $list[49] = "Users" $var = _AD_GetObjectsInOU("", "(objectcategory=group)", 2) _ArrayDisplay($var) For $i = Ubound($var) - 1 to 0 Step - 1 For $n = 0 to UBound($list) -1 If StringInStr($var[$i], $list[$n]) then _ArrayDelete($var, $i) EndIf Next Next _ArrayDisplay($var) _AD_Close() Result: Please note this is a screen shot taken from after the array delete loop is run. I notice that even though row 0 says there are 172 rows, after the delete there are only 89 rows (as you can see in the example). I doubt this makes any difference, but just throwing it out there. Link to comment Share on other sites More sharing options...
kor Posted March 24, 2011 Author Share Posted March 24, 2011 Put the 2 scripts together with the second script after the first one, making sure that all of your global declarations, and ALL of your #include statements are at the start of the script. Second just change the lines here: ; Add items For $i = 0 To UBound($array) - 1 _GUICtrlListView_AddItem($hListView, $array[$i]) Next To this: ; Add items For $i = 0 To UBound($var) - 1 _GUICtrlListView_AddItem($hListView, $var[$i]) Next And that should populate the ListView That worked! I had to change $i = 1 to remove the first row of the count of the groups, but yeah. thanks! Link to comment Share on other sites More sharing options...
kor Posted March 24, 2011 Author Share Posted March 24, 2011 kor, Have you tried? The array you get is an array of thetext in the item and all sub-items in the same row - so it would not help you much. You will have to create an array and then put the returns from _GUICtrlListView_GetItemText into the elements. M23 Trying this, but not working ; Loop until user exits Do $msg = GUIGetMsg() Select Case $msg = $button $1 = _GUICtrlListView_GetSelectedIndices($hListView, True) For $i = 1 To $1[0] ;$groups = _GUICtrlListView_GetItemText($hListView, $1[$i]) & @CRLF $groups = _GUICtrlListView_GetItemTextArray($hListView) Next _ArrayDisplay($groups) EndSelect Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 24, 2011 Moderators Share Posted March 24, 2011 kor, Of course it does not work, I told you it would not! But this might: ; Loop until user exits Do $msg = GUIGetMsg() Select Case $msg = $button Local $groups[$i[0] + 1] ; create an array $1 = _GUICtrlListView_GetSelectedIndices($hListView, True) For $i = 1 To $1[0] $groups[$i] = _GUICtrlListView_GetItemText($hListView, $1[$i]) ; load the elements of the array with the text of the items selected Next _ArrayDisplay($groups) ; And display them EndSelect Until $msg = $GUI_EVENT_CLOSE Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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