Sign in to follow this  
Followers 0
EKY32

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

3 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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
1 person likes this

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!

Share this post


Link to post
Share on other sites

Thank toy very much Mr. JScript Posted Image


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

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  
Followers 0