Listview auslesen und Variable auf 0 überprüfen

  • Hallo, habe folgenden code, und bekomme immer die MsgBox mit der 0. Kann mir wer sagen warum ?

    [autoit]

    #include <GUIConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    GUICreate("listview items",220,250, 100,200,-1)
    GUISetBkColor (0x00E0FFFF) ; will change background color

    [/autoit][autoit][/autoit][autoit]

    $listview = GUICtrlCreateListView ("col1 |col2|col3 ",10,10,200,150);,$LVS_SORTDESCENDING)
    $button = GUICtrlCreateButton ("Value?",75,170,70,20)
    $item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
    $item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
    $item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
    $input1=GUICtrlCreateInput("",20,200, 150)
    GUICtrlSetState(-1,$GUI_ACCEPTFILES) ; to allow drag and dropping
    GUISetState()
    GUICtrlSetData($item2,"ITEM1")
    GUICtrlSetData($item3,"||COL33")
    GUICtrlDelete($item1)

    [/autoit][autoit][/autoit][autoit]

    Do
    $msg = GUIGetMsg ()

    Select
    Case $msg = $button
    if GUICtrlRead(GUICtrlRead($listview)) = 0 Then
    MsgBox(0,"","Nu is aber 0!")
    Else
    MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
    endif
    Case $msg = $listview
    MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE

    [/autoit]

    DANKE

    • Offizieller Beitrag

    Probiers mal so:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("listview items",220,250, 100,200,-1)
    GUISetBkColor (0x00E0FFFF) ; will change background color

    [/autoit] [autoit][/autoit] [autoit]

    $listview = GUICtrlCreateListView ("col1 |col2|col3 ",10,10,200,150);,$LVS_SORTDESCENDING)
    $button = GUICtrlCreateButton ("Value?",75,170,70,20)
    $item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
    $item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
    $item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
    $input1=GUICtrlCreateInput("",20,200, 150)
    GUICtrlSetState(-1,$GUI_ACCEPTFILES) ; to allow drag and dropping
    GUISetState()
    GUICtrlSetData($item2,"ITEM1")
    GUICtrlSetData($item3,"||COL33")
    GUICtrlDelete($item1)

    [/autoit] [autoit][/autoit] [autoit]

    Do
    $msg = GUIGetMsg ()

    [/autoit] [autoit][/autoit] [autoit]

    Select
    Case $msg = $button
    if GUICtrlRead($listview) = 0 Then
    MsgBox(0,"","Nu is aber 0!")
    Else
    MsgBox(0,"listview item",GuiCtrlREad(GUICtrlRead($listview),2))
    endif
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE

    [/autoit]