jazzyjeff Posted June 6, 2012 Share Posted June 6, 2012 Hello,I have a script that I want to populate a ListView with security groups from my AD Structure. The problem is the list seems to populate with items, but the items are empty, so it looks like I have an empty list.I used some code from get the type of list that I wanted, and tweaked it for my own needs.expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> #include <AD.au3> #include <Array.au3> Global $listAllow, $Btn_Start, $Btn_Exit, $msg, $ret _AD_Open() Local $adGroups = _AD_GetObjectsInOU("OU=Security,OU=Groups,DC=tcaps,DC=net", "(objectclass=group)") _AD_Close() _ArrayDisplay($adGroups) $formAllow = GUICreate("Allowed Security Groups", 392, 322) $listAllow = GUICtrlCreateListView("", 40, 30, 310, 149, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL)) _GUICtrlListView_SetColumnWidth($listAllow, 0, 100) $Btn_Start = GUICtrlCreateButton("Start", 150, 200, 120, 40) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listAllow, $adGroups[$a]) Next _setbut() GUISetState(@SW_SHOW) GUISwitch($formAllow) WinActivate("Allowed Security Groups", "") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $Btn_Start If _checkbox_active($listAllow) = 1 Then MsgBox(0, "", "at least one is checked") EndIf Case Else _setbut() EndSelect WEnd Exit Func _checkbox_active($list) For $i = 0 To _GUICtrlListView_GetItemCount($listAllow) - 1 Step 1 If _GUICtrlListView_GetItemChecked($listAllow, $i) = 1 Then Return 1 EndIf Next Return 0 EndFunc ;==>_checkbox_active ; Func _setbut() If _checkbox_active($listAllow) Then If BitAND(GUICtrlGetState($Btn_Start), $GUI_DISABLE) Then GUICtrlSetState($Btn_Start, $GUI_ENABLE) EndIf ElseIf BitAND(GUICtrlGetState($Btn_Start), $GUI_ENABLE) Then GUICtrlSetState($Btn_Start, $GUI_DISABLE) EndIf EndFunc ;==>_setbutCan anyone see why ListView_AddItem is not working?Thanks. Link to comment Share on other sites More sharing options...
Zedna Posted June 6, 2012 Share Posted June 6, 2012 (edited) $listAllow = GUICtrlCreateListView("Column 1", 40, 30, 310, 149, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL)) With no column there are no data displayed If you don't want to show column's label in header then use space instead of empty string. Edited June 6, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
jazzyjeff Posted June 6, 2012 Author Share Posted June 6, 2012 Thanks Zedna. Missed a blindingly obvious there! 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