Jump to content

~ Resize columns of ListView when resizing window? (SOLVED)


EKY32
 Share

Recommended Posts

Is it possible to resize the GuiCtrlCreateListView column's width when resizing a window? as the list view has GUICtrlSetResizing(-1, $GUI_DOCKALL) and GUICtrlSetResizing(-1, $GUI_DOCKBORDERS).

Thank you.

Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Link to comment
Share on other sites

Try this:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hForm, $hListView
_Main()

Func _Main()
    $hForm = GUICreate("ListView Set Column Width", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW)
    $hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)

    GUIRegisterMsg($WM_SIZING, "_RegisterMsg")
    GUIRegisterMsg($WM_SIZE, "_RegisterMsg")

    GUISetState()

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>_Main

Func _RegisterMsg($hWnd, $Msg, $WParam, $LParam)
    Local $iColCount, $aGetSize, $iWidth

    $iColCount = _GUICtrlListView_GetColumnCount($hListView)

    $aGetSize = WinGetClientSize($hWnd)

    $iWidth = Int($aGetSize[0] / $iColCount)

    For $i = 0 To $iColCount
        _GUICtrlListView_SetColumnWidth($hListView, $i, $iWidth)
    Next
EndFunc

Regards,

João Carlos.

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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...