Ausgabe von GUICtrlCreateListView

  • Hi und zwar habe ich ein problem mit GUICtrlCreateListView

    [autoit]

    GUICtrlCreateListViewItem($hostname & '|' & $ping & '|' & $numplayers & '/' & $maxplayers & '|' & $mapname & '|' & $gametype & '|' & $lock & '|' & $s_ip & ':' & $s_port,$serverlist)

    [/autoit]

    Als rückgabewert der ausgewähelten zeile brauch ich

    [autoit]

    $s_ip & ':' & $s_port

    [/autoit]

    aber irgendwie will es nicht so richtig klappen

    bisher habe ich es nur geschafft, das er zurück gibt welche zeile gewähelt wurde

    wäre nett wenn mir da jemand helfen könnte. :)

    Einmal editiert, zuletzt von hofi02 (12. Oktober 2008 um 21:45)

  • [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Opt('MustDeclareVars', 1)

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

    Example()

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

    Func Example()
    Local $listview, $button, $item1, $item2, $item3, $input1, $msg,$tmp

    GUICreate("listview items", 600, 200, -1, -1, -1, $WS_EX_ACCEPTFILES)
    GUISetBkColor(0x00E0FFFF) ; will change background color

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

    $listview = GUICtrlCreateListView("hostname|ping|numplayers|maxplayers|mapname|gametype|lock", 0, 0, 600, 180);,$LVS_SORTDESCENDING)

    $button = GUICtrlCreateButton("Value?",0,180,600, 20)
    $item1 = GUICtrlCreateListViewItem("hostname1" & '|' & "ping1" & '|' & "numplayers1" & '/' & "maxplayers1" & '|' & "mapname1" & '|' & "gametype1" &'|' & "lock1" & '|' & "s_ip1" & ':' &"s_port1", $listview)
    $item2 = GUICtrlCreateListViewItem("hostname2" & '|' & "ping2" & '|' & "numplayers2" & '/' & "maxplayers2" & '|' & "mapname2" & '|' & "gametype2" &'|' & "lock2" & '|' & "s_ip2" & ':' &"s_port2", $listview)
    $item3 = GUICtrlCreateListViewItem("hostname3" & '|' & "ping3" & '|' & "numplayers3" & '/' & "maxplayers3" & '|' & "mapname3" & '|' & "gametype3" &'|' & "lock3" & '|' & "s_ip3" & ':' &"s_port3", $listview)
    $input1 = GUICtrlCreateInput("", 20, 200, 150)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
    GUISetState()

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

    Do
    $msg = GUIGetMsg()

    Select
    Case $msg = $button
    $tmp = GUICtrlRead(GUICtrlRead($listview))
    $tmp = StringMid($tmp,StringInStr($tmp,"|",0,-2)+1)
    $tmp = StringTrimRight($tmp,1)
    MsgBox(0, "listview item",$tmp, 2)
    Case $msg = $listview
    MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>Example

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