Jump to content

GUICtrlSetResizing on UDF ListView ?


TrueSR
 Share

Recommended Posts

Hey !

I was wondering if you can do something like GUICtrlSetResizing() on a ListView (or other control) created with an UDF.

example code :

#include <GUIConstants.au3>
#include <GuiListView.au3>

$Gui = GUICreate("Gui", 500, 500, 100, 100, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
$List = _GUICtrlListView_Create($Gui, "Name|Location", 10, 10, 480, 480)
_GUICtrlListView_SetExtendedListViewStyle($List, $LVS_EX_FULLROWSELECT)

GUISetState()

While 1
$Msg = GUIGetMsg()
If $Msg = $GUI_EVENT_CLOSE Then Exit
WEnd

In this example i want $GUI_DOCKBORDERS (2+4+32+64 = 102 -> see GUICtrlSetResizing() for more info)

Thanks in advance !

Link to comment
Share on other sites

Hey !

I was wondering if you can do something like GUICtrlSetResizing() on a ListView (or other control) created with an UDF.

example code :

#include <GUIConstants.au3>
#include <GuiListView.au3>

$Gui = GUICreate("Gui", 500, 500, 100, 100, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
$List = _GUICtrlListView_Create($Gui, "Name|Location", 10, 10, 480, 480)
_GUICtrlListView_SetExtendedListViewStyle($List, $LVS_EX_FULLROWSELECT)

GUISetState()

While 1
$Msg = GUIGetMsg()
If $Msg = $GUI_EVENT_CLOSE Then Exit
WEnd

In this example i want $GUI_DOCKBORDERS (2+4+32+64 = 102 -> see GUICtrlSetResizing() for more info)

Thanks in advance !

Being that UDF created controls are not monitored by AutoIt internal code you will have to monitor for resizing of the gui and size accordingly. WM_SIZE or something there of.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

TrueSR

Try this:

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

$Gui = GUICreate("Gui", 500, 500, 100, 100, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
$List = _GUICtrlListView_Create($Gui, "Name|Location", 10, 10, 480, 480)
_GUICtrlListView_SetExtendedListViewStyle($List, $LVS_EX_FULLROWSELECT)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

GUISetState()

While 1
    $Msg = GUIGetMsg()
    If $Msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    
    Local $iWidth = BitAND($lParam, 0xFFFF)
    Local $iHeight = BitShift($lParam, 16)
    
    _WinAPI_MoveWindow($List, 10, 10, $iWidth - 20, $iHeight - 20, True)
    
    Return $GUI_RUNDEFMSG
EndFunc
Link to comment
Share on other sites

TrueSR

Try this:

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

$Gui = GUICreate("Gui", 500, 500, 100, 100, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
$List = _GUICtrlListView_Create($Gui, "Name|Location", 10, 10, 480, 480)
_GUICtrlListView_SetExtendedListViewStyle($List, $LVS_EX_FULLROWSELECT)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

GUISetState()

While 1
    $Msg = GUIGetMsg()
    If $Msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    
    Local $iWidth = BitAND($lParam, 0xFFFF)
    Local $iHeight = BitShift($lParam, 16)
    
    _WinAPI_MoveWindow($List, 10, 10, $iWidth - 20, $iHeight - 20, True)
    
    Return $GUI_RUNDEFMSG
EndFunc

Works great, thanks !

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