Jump to content
Sign in to follow this  

Autosizing a listview after it has been edited?

Recommended Posts


Hello all I have been using the following function to resize my listview to show all text.

func _sizeconvolist()
   GUICtrlSendMsg($convolist, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE

It works great until I do 

_GUICtrlListView_InsertItem($convolist, "Some Text")

After this point, the listview no longer auto resizes, anyone have any idea why?

Share this post

Link to post
Share on other sites

Hi nullschritt

why you use _sizeconvolist() before AND after  _GUICtrlListView_EndUpdate($convolist) and not only after?

anyway, have You tried with _GUICtrlListView_SetColumnWidth($hWnd, $iCol, $iWidth) as BrewManNH suggested you in this >post?


from the autoit help for _GUICtrlListView_SetColumnWidth:

using $LVSCW_AUTOSIZE as value for $iWidth, Automatically sizes the column.


Edited by Pincopanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post

Link to post
Share on other sites


I would doing something like this:

_GUICtrlListView_SetColumnWidth($convolist, 0, $LVSCW_AUTOSIZE)
If _GUICtrlListView_GetColumnWidth($convolist, 0) < $default_listview_width Then
        _GUICtrlListView_SetColumnWidth($convolist, 0, $default_listview_width)


$default_listview_width is your const, it's the default width when create the ListView

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.