TLM wrote:
afaict you have to use WinMove to resize GUI windows.
there may be even a better way than my script if you figure out the amount of rows and update the control or window with an R[n] instead of W[n]. Still not 100% sure though. In my case I tried some janky char to gui size math

but it works

..
hth
SKAN wrote:
Icarus wrote:
I was hoping I can do this with GuiControl Move or MoveDraw, but was unsuccessful.
You may use
GuiControl,Move to resize the control after finding the Control's new size with
Laszlo's
GetTextSize()I would like a listview to adapt size according to the content in it.
ListView help
Eg - Listview window size would be larger (Height and width) if there is 30 rows of text than only 3 lines; also will be centered or positionned as instructed.
I searched for some time and found this thread.
GuiControl, Move is not working for me (I may use it uncorrectly).
WinMove seems to work, although I feel there might be better solutions.
I found how to get widht :
To set size, I need to find height (number of rows)
Code:
Rows:=LV_GetCount() ; gives rows count but rows height (size) is needed
Loop % LV_GetCount("Column") ; gives Columns numbers and size
{
SendMessage, 4125, A_Index - 1, 0, SysListView321 ; 4125 is LVM_GETCOLUMNWIDTH.
EnvAdd, Width, (Width + ErrorLevel)
}
WinMove, Code List, , , , Width, Rows * 15 ; added arbitrary number (pixel?) for row size
GuiControl +BackgroundBlack +Redraw, MyListView
If someone can help, It'll be of great relief.
