Function Reference

GUICtrlCreateListViewItem

Creates a ListView item.

GUICtrlCreateListViewItem ( "text", listviewID )

 

Parameters

text subitemtext separated with Opt("GUIDataSeparatorChar").
listviewID controlID of the ListView control holding the item.

 

Return Value

Success: Returns the identifier (controlID) of the new control.
Failure: Returns 0.

 

Remarks

This function creates the individual ListView items that can be selected. The items function as normal controls and can be set with GUICtrlSetData.
Items can be deleted as with any other control by using GUICtrlDelete.
ListView items can be dragged and drop into an Edit or Input control with a $GUI_DROPACCEPTED state.
See GUICtrlCreateListView about resizing of the column.

 

Related

GUICtrlCreateListView, GUICtrlSetData, GUICtrlSetState, GUICtrlDelete, GUIGetMsg, GUICtrlRead, GUIDataSeparatorChar (Option)

 

Example


#include <GUIConstants.au3>

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)
$item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview)
$item3=GuiCtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GuiCtrlCreateInput("",20,200, 150)
GuiCtrlSetState(-1,$GUI_DROPACCEPTED)   ; to allow drag and dropping
GuiSetState()
GUICtrlSetData($item2,"|ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)

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