Hi all, I'm not seeing in the docs that this is possible so asking to the world.
The question is simply in a ListView can you show the end of a long string rather than the beginning?
Example in my case is a long file path.
C:\somefolder\somefolder\somefolder\somefile.ext
If I set my columns to show only a specified width and the path is longer than that, I'd rather see for example:
mefolder\somefolder\somefile.ext
as opposed to what I currently see:
C:\somefolder\somefolder\somefol
the options LV_Modify(1, "Right") doesn't achieve this.
Thanks in advance!
Jules
LV_Modify show end of string
-
- Posts: 42
- Joined: 18 Apr 2017, 14:39
- Contact:
Re: LV_Modify show end of string
Code: Select all
; Get ListView column width with SendMessage (by Shimanov)
;
; https://docs.microsoft.com/en-us/windows/win32/controls/lvm-getcolumnwidth
; https://autohotkey.com/board/topic/6073-get-listview-column-width-with-sendmessage/
Gui, Add, ListView,, column 1|c2
LV_Add( "", "85385-485-384jdsf", "12" )
LV_ModifyCol()
Gui, Show
Process, Exist
WinGet, hw_gui, ID, ahk_class AutoHotkeyGUI ahk_pid %ErrorLevel%
SendMessage, 0x1000+29, 0, 0, SysListView321, ahk_id %hw_gui%
width_c0 := ErrorLevel
SendMessage, 0x1000+29, 1, 0, SysListView321, ahk_id %hw_gui%
width_c1 := ErrorLevel
MsgBox, %
( Join
"column 1 width = " width_c0
"`nc2 width = " width_c1
)
return
GuiClose:
ExitApp
It'll not provide the functionality you've requested. JFTR
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
-
- Posts: 42
- Joined: 18 Apr 2017, 14:39
- Contact:
Re: LV_Modify show end of string
Thank you. I appreciate the code snippet. I'm sure it'll come handy in the future. Unfortunately, yeah, won't really do what I was looking for. Been thinking of some hacky way of doing it where I sendkeys to move the cursor to the end, but that won't work for every row at the same time. Doing a substring to show only the ending would mean if user wanted to see the beginning of the string, they wouldn't be able to.
Re: LV_Modify show end of string
Yep, but you could display the full path, if the users mouse hovers over that fixed-length cell, either using a tooltip or at the status bar of the GUI.Doing a substring to show only the ending would mean if user wanted to see the beginning of the string, they wouldn't be able to.
Good luck
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
Re: LV_Modify show end of string
Is it the file name displayed with a path in ListView or is it some other long text?
If it is filename, I would split the filename into two parts with SplitPath and show the path in one column and the filename in the next.
For example .:
If it is filename, I would split the filename into two parts with SplitPath and show the path in one column and the filename in the next.
For example .:
Code: Select all
#EnvAdd
#SingleInstance force
FileName := "C:\somefolder\somefolder\somefolder\somefile.ext"
SplitPath FileName, fName, fPath
Gui, Add, ListView, x20 y20 r5 w310 grid, FilePath|FileName
LV_Add( "", fPath, fName )
LV_ModifyCol(1, 200)
LV_ModifyCol(2, 100)
Gui, Show, x100 y100 w350 h200, Filenames