mikedelk Posted April 2, 2008 Share Posted April 2, 2008 I just upgraded and noticed that when the controllistview SelectAll is called that the listview items do not get selected as they did previously. Any help is muchly appreciated. Mike Delk CODE; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.2.10 ; Author: Mike Delk ; ; Script Function: ; Provide a GUI to allow computer config for Disaster Recovery. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here ; #include <GuiConstants.au3> #include <file.au3> #include <process.au3> #include <misc.au3> #Include <GuiListView.au3> #include <Constants.au3> AutoItSetOption("TrayIconDebug", 1) Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 1) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 1) Opt("GUIOnEventMode", 1) Opt("RunErrorsFatal", 0) ; Declare Data Variables Dim $ver = "1.00" Dim $titlebar = "ControlListView " & $ver DIM $MAX_MACHINES=200,$NAME=0,$IP=1,$GATE=2,$NETWORK=3,$VERSION=4,$SYSTEM=5,$rndtrp=6,$STATE=7,$ENTRY=8,$UPDATE=9,$PASSWORD=10 Dim $Machines[$MAX_MACHINES][11] ; Create and Draw the GUI **************************************************************************************************** ****************************************** GUICreate($titlebar, 950, 660) GUISetOnEvent($GUI_EVENT_CLOSE, "Exit_") ; BUTTON $exit = GUICtrlCreateButton("EXIT", 650, 590,70,60) GuiCtrlSetOnEvent($exit, "Exit_") GUICtrlSetFont(-1, 10, 400, 1, "Arial Bold") GUICtrlSetBkColor( $exit, 0xff0000) GUICtrlSetTip($exit, "Exit DisasterRecovery Utility") $selall = GUICtrlCreateButton("SELECT ALL", 565, 525, 78, 60) GuiCtrlSetOnEvent($selall, "_selall") GUICtrlSetFont(-1, 9, 400, 1, "Arial Bold") GUICtrlSetBkColor( $selall, 0x888888) GUICtrlSetTip($selall, "Select all listview items.") $clearall = GUICtrlCreateButton("CLEAR ALL", 565, 590, 78, 60) GuiCtrlSetOnEvent($clearall, "_clearall") GUICtrlSetFont(-1, 9, 400, 1, "Arial Bold") GUICtrlSetBkColor( $clearall, 0x888888) GUICtrlSetTip($clearall, "Clear all listview items.") ; LIST VIEW $listView = GuiCtrlCreateListView("Computer Name| Computer IP | Gateway IP |NetType| DSPatchNET Version |System|RndTrp|", _ 10, 10, 708, 375,$LVS_EX_FULLROWSELECT+$LVS_SORTDESCENDING) GUICtrlSetFont($listview, 12, 400, -1, "Times New Roman") GUICtrlSetBkColor($listView, $COLOR_WHITE ) GUICtrlSetBkColor($listView,$GUI_BKCOLOR_LV_ALTERNATE) for $r=0 to 6 step 1 _GUICtrlListView_SetColumnWidth($listView,$r, $LVSCW_AUTOSIZE_USEHEADER ) Next ; Assign data to array, normally loaded from ini file $Machines[0][$NAME]="A" $Machines[0][$IP]="10.1.1.1" $Machines[0][$GATE]="10.1.1.201" $Machines[0][$NETWORK]="LAN" $Machines[0][$VERSION]="1.04" $Machines[0][$SYSTEM]="1" $Machines[0][$rndtrp]="10" $Machines[1][$NAME]="B" $Machines[1][$IP]="10.1.1.2" $Machines[1][$GATE]="10.1.1.201" $Machines[1][$NETWORK]="LAN" $Machines[1][$VERSION]="1.04" $Machines[1][$SYSTEM]="1" $Machines[1][$rndtrp]="10" $Machines[2][$NAME]="C" $Machines[2][$IP]="10.1.1.3" $Machines[2][$GATE]="10.1.1.201" $Machines[2][$NETWORK]="LAN" $Machines[2][$VERSION]="1.04" $Machines[2][$SYSTEM]="1" $Machines[2][$rndtrp]="10" $Machines[3][$NAME]="D" $Machines[3][$IP]="10.1.1.4" $Machines[3][$GATE]="10.1.1.201" $Machines[3][$NETWORK]="LAN" $Machines[3][$VERSION]="1.04" $Machines[3][$SYSTEM]="1" $Machines[3][$rndtrp]="10" ;create listview items for $a=0 to $MAX_MACHINES -1 if $Machines[$a][$NAME]="" Then ExitLoop EndIf $Machines[$a][$ENTRY]=GuiCtrlCreateListViewItem($Machines[$a][$NAME] & "|" & $Machines[$a][$IP] & _ "|" & $Machines[$a][$GATE] & "|" & $Machines[$a][$NETWORK] & _ "|" & $Machines[$a][$VERSION] & "|" & $Machines[$a][$SYSTEM] & _ "|" & $Machines[$a][$rndtrp] & "ms", $listView) GUICtrlSetColor( $Machines[$a][$ENTRY], $COLOR_GREEN ) GUICtrlSetBkColor($Machines[$a][$ENTRY], $COLOR_CREAM ) Next GUISetState() While 1 Sleep(1000) WEnd Func _selall() $ret=ControlListView( "","",$listview,"SelectAll") msgbox(0,"DEBUG","ListViewControl SelectAll Return Value=" & $ret & " @error=" & @error) Return EndFunc Func _clearall() ; Clear listview $ret=ControlListView( "","",$listview,"SelectClear") msgbox(0,"DEBUG","ListViewControl SelectClear Return Value=" & $ret & " @error=" & @error) Return EndFunc Func Exit_() GUIDelete() exit (0) EndFunc ;==>Exit_ Link to comment Share on other sites More sharing options...
Zedna Posted April 2, 2008 Share Posted April 2, 2008 ... $gui = GUICreate($titlebar, 950, 660) ... $listview = GuiCtrlCreateListView("Computer Name| Computer IP | Gateway IP |NetType| DSPatchNET Version |System|RndTrp|", _ 10, 10, 708, 375,$LVS_EX_FULLROWSELECT+$LVS_SORTDESCENDING) $listviewHandle = ControlGetHandle ( $gui,"",$listview) ... Func _selall() $ret=ControlListView( $gui,"",$listviewHandle,"SelectAll") msgbox(0,"DEBUG","ListViewControl SelectAll Return Value=" & $ret & " @error=" & @error) Return EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
mikedelk Posted April 2, 2008 Author Share Posted April 2, 2008 ... $gui = GUICreate($titlebar, 950, 660) ... $listview = GuiCtrlCreateListView("Computer Name| Computer IP | Gateway IP |NetType| DSPatchNET Version |System|RndTrp|", _ 10, 10, 708, 375,$LVS_EX_FULLROWSELECT+$LVS_SORTDESCENDING) $listviewHandle = ControlGetHandle ( $gui,"",$listview) ... Func _selall() $ret=ControlListView( $gui,"",$listviewHandle,"SelectAll") msgbox(0,"DEBUG","ListViewControl SelectAll Return Value=" & $ret & " @error=" & @error) Return EndFunc I have figured out the problem. Thanks for your help. I added a controlfocus command prior to the controllistview selectall and now everything is selected. Mike Delk 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