Jump to content

Resize TreeView created with _GUICtrlTreeView_Create


water
 Share

Recommended Posts

A TreeView control created with GUICtrlCreateTreeView changes its size correctly when the Window is resized.

A TreeView control created with _GUICtrlTreeView_Create doesn't change its size when the Window is resized.

I've been searching the forums but I'm obviously too blind to see what styles it needs to correctly resize a _GUICtrlTreeView_Create control

#include-once
#include <WindowsConstants.au3>
#include <GUITreeView.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

Global $hForm1 = GUICreate("Test", 942, 717, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))
;Global $hTree = _GUICtrlTreeView_Create($hForm1, 8, 24, 313, 610)
Global $TreeId = GUICtrlCreateTreeView(8, 24, 313, 610)
Global $hGUIGroupList       = GUICtrlCreateListView("Gruppe|Zugriffsrechte (Verzeichnis und Dateien)", 328, 24, 601, 305, $LVS_SHOWSELALWAYS)
Global $hGUIGroupUserList   = GUICtrlCreateListView("Name|Typ", 328, 352, 601, 282, $LVS_SHOWSELALWAYS)
GUISetState(@SW_SHOW)

While 1
    $vMsg = GUIGetMsg()
    Select
        Case $vMsg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

water

Example:

#include-once
#include <WindowsConstants.au3>
#include <GUITreeView.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

Global $hForm1 = GUICreate("Test", 300, 200, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))

Global $hTree = _GUICtrlTreeView_Create($hForm1, 10, 10, 150, 180)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

GUISetState(@SW_SHOW)

While 1
    $vMsg = GUIGetMsg()
    Select
        Case $vMsg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func _WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    Local $iWidth = BitAND($lParam, 0x0000FFFF)
    Local $iHeight = BitShift($lParam, 16)
    
    _WinAPI_MoveWindow($hTree, 10, 10, $iWidth - 150, $iHeight - 20)
EndFunc   ;==>_WM_SIZE
Link to comment
Share on other sites

Hi rasim,

thanks a lot!

That really helps to improve my script.

Thomas

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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