Thomas Segeth Posted April 27, 2006 Share Posted April 27, 2006 Hello AutoIT Community, this is my first post So i am a Newbie (And sorry for my english) I'm currently developing a script, but i have encountered a problem or maybe a possible bug. The script at the bottom of the posting is only a part of the main script, but the error must be in this part. For Explanation: $Depotfilearray is a dynamic array but in this script i hav changed it to an array with the size 5. For each element of this array a listviewelement should be created. If $Importbutton2 is pressed, all selected elements should be returned (in the whoele script this scriptpart is only a function) But there is a strange behaviour: Initially all Elements are selected, the debug msgbox (activated if you press Import) shows the correct results (at least i think so.... a 1 should be returned if checked, right?) BUT, if you deselect all elements and then select another time, always one element is missing. An the result returned for this element is a number between 260 and 276.... Am I doing something wrong or ist his a bug? Please help me Thank you guys in advance #include <GUIConstants.au3> $Nebenfenster = GUICreate("DXU - Import/Export Tool",400,400,400,400, $WS_SIZEBOX) GUISwitch($Nebenfenster) GUISetState(@SW_SHOW) GUICtrlCreateLabel("DXU - Import", 30, 10) Dim $DepotfileArray[5] $DepotfileArray[0] = 5 $DepotfileArray[1] = "This" $DepotfileArray[2] = "is" $DepotfileArray[3] = "for" $DepotfileArray[4] = "testing" Dim $checkCN[$DepotfileArray[0]] $checkCN[0] = $DepotfileArray[0] $Itembaum = GuiCtrlCreateTreeView(30, 30, 350, 300, $TVS_CHECKBOXES + $WS_VSCROLL) $Importbutton2=GUICtrlCreateButton ("Import", 30, 340, 100) for $i = 1 to $DepotfileArray[0]-1 Step 1 $checkCN[$i] = GuiCtrlCreateTreeViewItem($DepotfileArray[$i], $Itembaum) GUICtrlSetState (-1, 1) Next While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $Importbutton2 for $j = 1 to $checkCN[0]-1 Step 1 ;MsgBox(0, "Debug:", $DepotfileArray[$j] & "ControlID: " & $checkCN[$j]) ;if GUICtrlRead($checkCN[$j]) = $GUI_CHECKED Then MsgBox(0, "Test", $DepotfileArray[$j] & ": " & GUICtrlRead($checkCN[$j]) & " " & GUICtrlGetState($checkCN[$j])) ;endif Next EndSelect WEnd Link to comment Share on other sites More sharing options...
GaryFrost Posted April 27, 2006 Share Posted April 27, 2006 the problem is how your checking the state, the state can be a combination of things, checked/unchecked selected etc... expandcollapse popup#include <GUIConstants.au3> $Nebenfenster = GUICreate("DXU - Import/Export Tool", 400, 400, 400, 400, $WS_SIZEBOX) GUISwitch($Nebenfenster) GUISetState(@SW_SHOW) GUICtrlCreateLabel("DXU - Import", 30, 10) Dim $DepotfileArray[5] $DepotfileArray[0] = 5 $DepotfileArray[1] = "This" $DepotfileArray[2] = "is" $DepotfileArray[3] = "for" $DepotfileArray[4] = "testing" Dim $checkCN[$DepotfileArray[0]] $checkCN[0] = $DepotfileArray[0] $Itembaum = GUICtrlCreateTreeView(30, 30, 350, 300, $TVS_CHECKBOXES + $WS_VSCROLL) $Importbutton2 = GUICtrlCreateButton("Import", 30, 340, 100) For $i = 1 To $DepotfileArray[0] - 1 Step 1 $checkCN[$i] = GUICtrlCreateTreeViewItem($DepotfileArray[$i], $Itembaum) GUICtrlSetState(-1, 1) Next While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $Importbutton2 For $j = 1 To $checkCN[0] - 1 Step 1 If BitAND(GUICtrlRead($checkCN[$j]), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox(0, "Test", $DepotfileArray[$j] & ": is checked") EndIf Next EndSelect WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Thomas Segeth Posted April 28, 2006 Author Share Posted April 28, 2006 the problem is how your checking the state, the state can be a combination of things, checked/unchecked selected etc...Dear gafrost,thank you for helping me out in this matter. Your solution works fine. 2 thumps up!! 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