Jump to content

Recommended Posts

Posted

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
    GUICtrlSendMsg($convolist, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER
EndFunc

It works great until I do 

_GUICtrlListView_BeginUpdate($convolist)
_GUICtrlListView_DeleteAllItems($convolist)
_GUICtrlListView_InsertItem($convolist, "Some Text")
_sizeconvolist()
_GUICtrlListView_EndUpdate($convolist)
_sizeconvolist()

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

Posted (edited)

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?

EDIT:

from the autoit help for _GUICtrlListView_SetColumnWidth:

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

bye

Edited by Pincopanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Posted

Hi,

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)
EndIf

 

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

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
×
×
  • Create New...