Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $listview, $button, $item1, $item2, $item3, $item4, $item5, $item6, $input1, $msg
GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color
$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
$item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview)
GUICtrlSetState(-1, $GUI_FOCUS)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
GUICtrlSetState(-1, $GUI_FOCUS)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
GUICtrlSetState(-1, $GUI_FOCUS)
$item4 = GUICtrlCreateListViewItem("item4|col41|col42", $listview)
GUICtrlSetState(-1, $GUI_FOCUS)
$item5 = GUICtrlCreateListViewItem("item5|col51|col52", $listview)
GUICtrlSetState(-1, $GUI_FOCUS)
$item6 = GUICtrlCreateListViewItem("item6|col61|col62", $listview)
;GUICtrlSetState(-1, $GUI_FOCUS)
$input1 = GUICtrlCreateInput("", 20, 200, 150)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
GUISetState()
Do
$msg = GUIGetMsg()
Select
Case $msg = $button
MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
Case $msg = $listview
MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc ;==>Example