To save you looking it up this is the code:
Code: Select all
; Create the ListView with two columns, Name and Size:
Gui, Add, ListView, r20 w700 gMyListView, Name|Size (KB)
; Gather a list of file names from a folder and put them into the ListView:
Loop, %A_MyDocuments%\*.*
LV_Add("", A_LoopFileName, A_LoopFileSizeKB)
LV_ModifyCol() ; Auto-size each column to fit its contents.
LV_ModifyCol(2, "Integer") ; For sorting purposes, indicate that column 2 is an integer.
; Display the window and return. The script will be notified whenever the user double clicks a row.
Gui, Show
return
MyListView:
if (A_GuiEvent = "DoubleClick")
{
LV_GetText(RowText, A_EventInfo) ; Get the text from the row's first field.
ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
}
return
GuiClose: ; Indicate that the script should exit automatically when the window is closed.
ExitApp
If I try to do something like:
LV_ModifyCol(2,"Integer AutoHdr") ;the column width suddenly jumps to the entire leftover width in the listview.
I also tried:
LV_ModifyCol(,"AutoHdr") ;thinking that perhaps if I left the column number out it would work -- but sadly no
Is there any simple way to make it look like this:
(other than manually resizing it, which is what I did here...)
Thanks!
Edit: The images didn't come through -- the URLs are:
https://imgur.com/sijfCkA
https://imgur.com/yjsx5ML
They should be public