Docfxit Posted October 3, 2007 Share Posted October 3, 2007 I'm trying to debug a script with the AutoIt Debugger ver. 0.11.0 When I get into a GUI loop I can't get it to recognize the correct $msg = GUIGetMsg() The debugger tells me $msg is equal to -11 Does anyone know what I can do to get $msg = $listbox ? GUICreate("Select an expense account for - " & $asFields[5], 550, 250, -1, -1) $listbox = GUICtrlCreateList("", 125, 40, 180, 120) GUICtrlSetData($listbox, "Car/Truck Expense:Gas|Travel & Entertainment:Meals|Hardware") ; $label = GUICtrlCreateLabel("Account", 150, 210, 120) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $listbox $AccountSelected = _GUICtrlListGetText($listbox, _GUICtrlListSelectedIndex($listbox)) If ($AccountSelected == $LB_ERR) Then MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText") Else ; GUICtrlSetData($label, "Item : " & $AccountSelected) $ExpenseAccount = '"' & $AccountSelected & '"' ExitLoop EndIf EndSelect WEnd Thank you, Docfxit Link to comment Share on other sites More sharing options...
Stumpii Posted October 3, 2007 Share Posted October 3, 2007 I don't think you can do that. The easiest way is to use a button and detect that event and us it to read the contents of the listbox. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
Docfxit Posted October 3, 2007 Author Share Posted October 3, 2007 I don't think you can do that. The easiest way is to use a button and detect that event and us it to read the contents of the listbox.Do you have any idea how I would code that?Thank you,Docfxit Link to comment Share on other sites More sharing options...
Stumpii Posted October 3, 2007 Share Posted October 3, 2007 Do you have any idea how I would code that? Thank you, Docfxit #include <GUIConstants.au3> #Include <GuiListBox.au3> GUICreate("My GUI list"); will create a dialog box that when displayed is centered $add = GUICtrlCreateButton("Test", 64, 32, 75, 25) $mylist = GUICtrlCreateList(StringFormat("%03d : Random string", Random(1, 100, 1)), 176, 32, 121, 97) GUICtrlSetLimit(-1, 200); to limit horizontal scrolling _GUICtrlListBox_AddString ($mylist, StringFormat("%03d : Random string", Random(1, 100, 1))) _GUICtrlListBox_AddString ($mylist, StringFormat("%03d : Random string", Random(1, 100, 1))) _GUICtrlListBox_AddString ($mylist, StringFormat("%03d : Random string", Random(1, 100, 1))) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $add MsgBox(0,"",GUICtrlRead ( $mylist )) Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. 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