Sign in to follow this  
Followers 0
ShawnW

How do I resize _GUICtrlListView_Create() with my window

4 posts in this topic

So the normal way of resizing a gui control along with your window is to use GUICtrlSetResizing() which requires the controlID.

Since _GUICtrlListView_Create() only returns the handle, and I could not find a way to look up a controlID based on that, I used AU3Info to determine that my listview seems to always have an ID of 10000. Using this though I am still unable to get the listview created with the UDF method to resize along with the window. Can someone help?

Share this post


Link to post
Share on other sites



Have you tried using the handle as the controlID?


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#include <GuiConstantsEx.au3>

#include <GuiListView.au3>

#include <WindowsConstants.au3>



Opt("GUIResizeMode", 2 + 32 + 256 + 512) ; 802



Local $GUI, $hImage

$GUI = GUICreate("Создание ListView", 400, 300, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN))



$hListView = _GUICtrlListView_Create($GUI, "", 10, 10, 400 - 20, 300 - 20, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $WS_CLIPCHILDREN), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_INFOTIP))

_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))

; Add columns

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

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

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



; Add items

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



GUISetState()

GUIRegisterMsg($WM_SIZE, "WM_SIZE")



Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE



Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)

    Local $iHeight, $iWidth

    $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord

    $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord

    _WinAPI_MoveWindow($hListView, 10, 10, $iWidth - 20, $iHeight - 20)

    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