Jump to content

Resize listview columns


Recommended Posts

Hi everyone!

Can i auto-resize the columns of a listview?

When I fill in the listviewitems, the columns don't change their size.

After all the listviewitems are in the listview, I have to double click the seperators in the column-header, which resizes the column to a perfect width.

Is there a way to perform the resize in the script?

Thanks in advance

pizzaking

Link to comment
Share on other sites

  • Developers

Hi everyone!

Can i auto-resize the columns of a listview?

When I fill in the listviewitems, the columns don't change their size.

After all the listviewitems are in the listview, I have to double click the seperators in the column-header, which resizes the column to a perfect width.

Is there a way to perform the resize in the script?

Thanks in advance

pizzaking

<{POST_SNAPBACK}>

Did you try _GUICtrlListViewSetColumnWidth() which is avialble in the latest Beta ....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I was able to help myself with

$GUI = GUICreate(..)
$LIST_VIEW = GuiCtrlCreateListView(..)
..
ControlFocus ( $GUI, "", $LIST_VIEW )
Send("{DOWN}^{NUMPADADD}")
..

But there might be a better way with GUICtrlSendMsg, LVM_SETCOLUMNWIDTH and LVSCW_AUTOSIZE as described in the MSDN Library, but I cant figure out how. :(

Anyway: the code above works fine for me.

@JdeB : Thanks for the reply, I didn't try it, because I still don't have the new beta. But it sounds very good (and GUICtrlSendMsg shouldn't be needed). I will try later!

pizzaking

Link to comment
Share on other sites

But there might be a better way with GUICtrlSendMsg, LVM_SETCOLUMNWIDTH and LVSCW_AUTOSIZE as described in the MSDN Library, but I cant figure out how. :(

Global Const $LVM_FIRST = 0x1000
Global Const $LVM_SETCOLUMNWIDTH = $LVM_FIRST+30
Global Const $LVSCW_AUTOSIZE = -1
Global Const $LVSCW_AUTOSIZE_USEHEADER = -2

; Your code here

; To resize to widest value
GUICtrlSendMsg($listviewhandle, $LVM_SETCOLUMNWIDTH, $columnindex, $LVSCW_AUTOSIZE)
; To resize to column header
GUICtrlSendMsg($listviewhandle, $LVM_SETCOLUMNWIDTH, $columnindex, $LVSCW_AUTOSIZE_USEHEADER)

$columnindex is zero-based

Edited by SumTingWong
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...