zorphnog Posted May 6, 2009 Share Posted May 6, 2009 So I've been trying to get my tree view control to resize properly, and it does everything but dock to the bottom of the GUI. It works fine when I use it on a GUICtrlCreateTreeView control, but stops working when I use _GUICtrlTreeView_Create. Unfortunately, TVN_SELCHANGED doesn't work with GUICtrlCreateTreeView or else I would use it. Any ideas? expandcollapse popup#include <GUIConstants.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> AutoItSetOption("MustDeclareVars", 1) Global $iWidth = 538, $iHeight = 522, $hMainGUI, $lvUsers, $tvRegistry, $tviRoot, $lvRegistry Global $nMsg, $aPos #Region ### START Koda GUI section ### Form= $hMainGUI = GUICreate("MHRT", $iWidth, $iHeight, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUICtrlCreateGroup(" Profiles ", 8, 8, $iWidth - 16, 113) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKHEIGHT, $GUI_DOCKTOP)) $lvUsers = GUICtrlCreateListView("Name|SID|Profile|RefCount", 16, 24, $iWidth - 32, 86) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKHEIGHT, $GUI_DOCKTOP)) GUICtrlSendMsg(-1, 0x101E, 0, 100) GUICtrlSendMsg(-1, 0x101E, 1, 100) GUICtrlSendMsg(-1, 0x101E, 2, 100) GUICtrlSendMsg(-1, 0x101E, 3, 100) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup(" Registry ", 8, 128, $iWidth - 16, $iHeight - 136) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM, $GUI_DOCKTOP)) $tvRegistry = _GUICtrlTreeView_Create($hMainGUI, 16, 144, 153, $iHeight - 161, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKWIDTH, $GUI_DOCKBOTTOM, $GUI_DOCKTOP)) $tviRoot = _GUICtrlTreeView_Add($tvRegistry, 0, "\") $lvRegistry = GUICtrlCreateListView("Name|Type|Data", 176, 144, $iWidth - 192, $iHeight - 161) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM, $GUI_DOCKTOP)) GUICtrlSendMsg(-1, 0x101E, 0, 100) GUICtrlSendMsg(-1, 0x101E, 1, 100) GUICtrlSendMsg(-1, 0x101E, 2, 100) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Authenticity Posted May 6, 2009 Share Posted May 6, 2009 expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> AutoItSetOption("MustDeclareVars", 1) Global $iWidth = 538, $iHeight = 522, $hMainGUI, $lvUsers, $tvRegistry, $tviRoot, $lvRegistry Global $nMsg, $aPos Global $hTreeView GUIRegisterMsg($WM_NOTIFY, 'OnNotify') #Region ### START Koda GUI section ### Form= $hMainGUI = GUICreate("MHRT", $iWidth, $iHeight, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUICtrlCreateGroup(" Profiles ", 8, 8, $iWidth - 16, 113) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKHEIGHT, $GUI_DOCKTOP)) $lvUsers = GUICtrlCreateListView("Name|SID|Profile|RefCount", 16, 24, $iWidth - 32, 86) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKHEIGHT, $GUI_DOCKTOP)) GUICtrlSendMsg(-1, 0x101E, 0, 100) GUICtrlSendMsg(-1, 0x101E, 1, 100) GUICtrlSendMsg(-1, 0x101E, 2, 100) GUICtrlSendMsg(-1, 0x101E, 3, 100) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup(" Registry ", 8, 128, $iWidth - 16, $iHeight - 136) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM, $GUI_DOCKTOP)) $tvRegistry = GUICtrlCreateTreeView(16, 144, 153, $iHeight - 161, -1, $WS_EX_CLIENTEDGE) $hTreeView = GUICtrlGetHandle(-1) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKWIDTH, $GUI_DOCKBOTTOM, $GUI_DOCKTOP)) $tviRoot = _GUICtrlTreeView_Add($tvRegistry, 0, "\") $lvRegistry = GUICtrlCreateListView("Name|Type|Data", 176, 144, $iWidth - 192, $iHeight - 161) GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM, $GUI_DOCKTOP)) GUICtrlSendMsg(-1, 0x101E, 0, 100) GUICtrlSendMsg(-1, 0x101E, 1, 100) GUICtrlSendMsg(-1, 0x101E, 2, 100) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func OnNotify($hwnd, $iMsg, $iwParam, $ilParam) Local $tNMTREEVIEW = DllStructCreate($tagNMTREEVIEW, $ilParam) Local $hItem If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = $hTreeView Then Switch DllStructGetData($tNMTREEVIEW, 'Code') Case $TVN_SELCHANGED, $TVN_SELCHANGEDW $hItem = DllStructGetData($tNMTREEVIEW, 'NewhItem') ConsoleWrite(_GUICtrlTreeView_GetText($hTreeView, $hItem) & @LF) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
zorphnog Posted May 6, 2009 Author Share Posted May 6, 2009 Excellent! I did not know about TVN_SELCHANGEDW. Thanks. Link to comment Share on other sites More sharing options...
zorphnog Posted May 7, 2009 Author Share Posted May 7, 2009 Also, I just noticed the _GUICtrlTreeView_SetUnicodeFormat function. If you set it to False (ANSI), then the GUICreateTreeView control will correctly receive TVN_SELCHANGED notifications. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now