Sign in to follow this  
Followers 0
dbkaynor

ListView resizing

2 posts in this topic

When I create a list view with _GUICtrlListView_Create the control will not resize when the parent window is resized. Is there a way to enable this? I has tried a bunch of different options with no success.

Share this post


Link to post
Share on other sites



#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

$GUI = GUICreate("ListView SIZE example", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX))
$hListView = _GUICtrlListView_Create ($GUI, "", 2, 2, 396, 296, $LVS_REPORT, $WS_EX_CLIENTEDGE )
_GUICtrlListView_SetExtendedListViewStyle ($hListView, $LVS_EX_FULLROWSELECT)
GUISetState()
GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

_GUICtrlListView_InsertColumn ($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn ($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn ($hListView, 2, "Column 3", 100)

_GUICtrlListView_AddItem ($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem ($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem ($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem ($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem ($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem ($hListView, "Row 3: Col 1", 2)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func MY_WM_SIZE()
    $size = WinGetClientSize($GUI)
    ControlMove($GUI, '', $hListView, 2, 2, $size[0] - 4, $size[1] - 4)
    Return $GUI_RUNDEFMSG
EndFunc

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