Creates a ListView control for the GUI.
GUICtrlCreateListView ( "text", left, top [, width [, height [, style = -1 [, exStyle = -1]]]] )
To add items to a ListView control use GUICtrlCreateListViewItem()
The ListView will appear by default as in the Explorer view "Details" (LVS_REPORT style is forced).
You can control initial column size by padding blanks to the column heading definition. The column can be extend during the GUICtrlCreateListViewItem() according to item size. Size of a column will be up to around 25 characters. No resizing will be done during an update by GUICtrlSetData().
To create a ListView with Icon-, SmallIcon- or List-style just use after creation:
GUICtrlSetStyle() with the styles $LVS_ICON, $LVS_LIST or $LVS_SMALLICON.
Sorting the list by clicking the column name (as in Explorer) is not currently implemented.
To have the entire line visually selected use the extended style LVS_EX_FULLROWSELECT.
To combine styles with the default style use BitOR($GUI_SS_DEFAULT_LISTVIEW, newstyle, ... ).
To use the values specified above you must #include <ListViewConstants.au3> in your script.
If you add the style $LVS_EX_CHECKBOXES to the ListView, then the borders are removed. Add the style $WS_EX_CLIENTEDGE to display the borders.
The special flag $GUI_BKCOLOR_LV_ALTERNATE can be used with Listview control to give alternate background of the ListviewItems lines.
The odd lines will get the color set by GUICtrlSetBkColor() of the Listview control.
The even lines will get the color set by GUICtrlSetBkColor() of the ListviewItem control.
GUICoordMode (Option), GUICtrlCreateListViewItem, GUICtrlRegisterListViewSort, GUICtrlSetData, GUIDataSeparatorChar (Option), GUIGetMsg
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsStylesConstants.au3>
Example()
Func Example()
GUICreate ("listview items",220,250,100,200,- 1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color
Local $idListview= GUICtrlCreateListView ("col1 |col2|col3 ",10,10,200,150);,$LVS_SORTDESCENDING)
Local $idButton= GUICtrlCreateButton ("Value?",75,170,70,20)
Local $idLVi_Item1= GUICtrlCreateListViewItem ("item2|col22|col23",$idListview)
Local $idLVi_Item2= GUICtrlCreateListViewItem ("item1|col12|col13",$idListview)
Local $idLVi_Item3= GUICtrlCreateListViewItem ("item3|col32|col33",$idListview)
GUICtrlCreateInput ("",20,200,150)
GUICtrlSetState (-1,$GUI_DROPACCEPTED); to allow drag and dropping
GUISetState (@SW_SHOW )
GUICtrlSetData ($idLVi_Item2,"ITEM1")
GUICtrlSetData ($idLVi_Item3,"||COL33")
GUICtrlDelete ($idLVi_Item1)
; Loop until the user exits.
While 1
Switch GUIGetMsg ()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
MsgBox ($MB_SYSTEMMODAL,"listview item",GUICtrlRead (GUICtrlRead ($idListview)),2)
Case $idListview
MsgBox ($MB_SYSTEMMODAL,"listview","clicked="&GUICtrlGetState ($idListview),2)
EndSwitch
WEnd
EndFunc ;==>Example