Docfxit 7 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 Share this post Link to post Share on other sites
Stumpii 4 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. Share this post Link to post Share on other sites
Docfxit 7 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 Share this post Link to post Share on other sites
Stumpii 4 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. Share this post Link to post Share on other sites