MattHiggs Posted February 21, 2016 Posted February 21, 2016 (edited) Hey all. So I am trying to create a GUI in Koda, and I have the "multiple columns" style selected, since I want to display a file in one column and it's creation date in the other. However, I do not see any documentation or explanation as to HOW to actually put information into the second column: I tried using the delimiter (|) like you would in a list view, but that just creates a new entry in the list. Can anybody advise? Edited February 21, 2016 by MattHiggs
AutoBert Posted February 21, 2016 Posted February 21, 2016 I think: GUICtrlCreateListView is the better choice.
MattHiggs Posted February 21, 2016 Author Posted February 21, 2016 *sigh*. Yeah I figured. List views are somewhat more complicated (and require more code), so I was hoping to avoid. Oh well. Appreciate it.
AutoBert Posted February 21, 2016 Posted February 21, 2016 Listview's aren't complicated, here a small example: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <FileConstants.au3> #include <GuiListView.au3> Example() Func Example() GUICreate("FileInfos in Listview", 640, 480) GUISetBkColor(0x00E0FFFF) ; will change background color Local $idListview = GUICtrlCreateListView("Name |Creation Date|last accessed|last modified ", 10, 10, 620, 400) ;,$LVS_SORTDESCENDING) Local $sPath="C:\Program Files\AutoIt3\Examples\Helpfile\",$sLVItem Local $aFiles= _FileListToArray($sPath,"*.au3",$FLTA_FILES) for $i=1 to $aFiles[0] ;populate Listview with Filenames $sLVItem=$aFiles[$i]&'|'&_GetFormatedFileTime($sPath&$aFiles[$i],$FT_CREATED) $sLVItem&='|'&_GetFormatedFileTime($sPath&$aFiles[$i],$FT_ACCESSED) $sLVItem&='|'&_GetFormatedFileTime($sPath&$aFiles[$i],$FT_MODIFIED) GUICtrlCreateListViewItem($sLVItem,$idListview) Next Local $idButton = GUICtrlCreateButton("Value?", 75, 450, 70, 20) _GUICtrlListView_SetColumnWidth($idListview,0,$LVSCW_AUTOSIZE ) GUISetState(@SW_SHOW) ; 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 Func _GetFormatedFileTime($sFile,$iOption) Local $aDate = FileGetTime($sFile, $iOption), $sDate If IsArray($aDate) Then $sDate = $aDate[2] & '.' & $aDate[1] & '.' & $aDate[0] & ' ' & $aDate[3] & ':' & $aDate[4] & ':' & $aDate[5] Else $sDate = '' EndIf Return $sDate EndFunc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now