Hi,
I'm creating ListBox with _GuiCtrlListBox_Create and I want my programm to react as soon as item is selected in list box, here is my code:
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $hGUI, $msg, $mylist, $file2, $selection
$hGUI = GUICreate("My GUI list")
$file2 = GUICtrlCreateInput("", 10, 200, 300, 20)
; GUI List Box:
$mylist = _GuiCtrlListBox_Create($hGUI, "", 176, 32, 121, 97, BitOR($LBS_STANDARD, $LBS_NOTIFY))
; Add Items to List Box
_GUICtrlListBox_BeginUpdate($mylist);
_GUICtrlListBox_AddString($mylist, "Line 0")
_GUICtrlListBox_AddString($mylist, "Line 1")
_GUICtrlListBox_AddString($mylist, "Line 2")
_GUICtrlListBox_AddString($mylist, "Line 3")
_GUICtrlListBox_AddString($mylist, "Line 4")
_GUICtrlListBox_EndUpdate($mylist);
; Activate GUI`
GUISetState()
; Main Message Loop
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $mylist
; <===!!!===> this code never runs
$selection = _GUICtrlListBox_GetSelItems($mylist)
GUICtrlSetData($file2, $selection[1])
EndSwitch
WEnd
EndFunc ;==>Example
But the code that should react to list box changes is never called, how do I go about it.
Sorry if this is silly question, I'm just starting with AutoIt, I've tried googling this but cannot find definite answer how to handle this.
Thanks. This is my first post.
Ugnius