c.haslam Posted October 6, 2018 Share Posted October 6, 2018 (edited) I have a resizable GUI that looks like this initially: but when I decrease the height it looks like this: My code is: GUICtrlSetResizing($cTreeView,$GUI_DOCKTOP+$GUI_DOCKLEFT+$GUI_DOCKRIGHT) GUICtrlSetResizing($cCan_Button,$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUICtrlSetResizing($cSel_Button,$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) ; How can I keep the Select and Cancel buttons below the treeview? Edited October 6, 2018 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
AutoBert Posted October 6, 2018 Share Posted October 6, 2018 My already showed demo, extended with resizing: Spoiler expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <WindowsConstants.au3> ; *** End added by AutoIt3Wrapper *** #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <APIShellExConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiListView.au3> #include <File.au3> Global Const $tagSHFILEINFO = 'ptr hIcon; int iIcon; DWORD dwAttributes; CHAR szDisplayName[255]; CHAR szTypeName[80];' Global $FOLDER_ICON_INDEX = _GUIImageList_GetFileIconIndex(@SystemDir, True, 1) ;Global $UP_ICON_INDEX = _GUIImageList_GetFileIconIndex($sIconDir & 'up.ico', True, 1) Global $idTV, $idRoot, $hIcon Global $aDirs, $aFiles ; Create GUI Global $hGui = GUICreate("Demo _GUICtrlTreeView_AddChild", 500, 610, 0, 0, $WS_SIZEBOX) GUISetFont(10) $idTV = GUICtrlCreateTreeView(2, 2, 494, 544) ;$hTV = ControlGetHandle($hGui, '', $idTV) ;use $hTV if needed, the controlid is not accepted _GUICtrlTreeView_SetNormalImageList($idTV, _GUIImageList_GetSystemImageList(False)) GUISetState(@SW_SHOW) Global $sAutoItPath = StringReplace(StringReplace(@AutoItExe, '_x64', ''), 'autoit3.exe', '') ;ConsoleWrite($sAutoItPath&@CRLF) Global $idSel_Button = GUICtrlCreateButton('Select', 300, 555) Global $idCan_Button = GUICtrlCreateButton('Cancel', 400, 555) GUICtrlSetResizing($idTV, BitOR($GUI_DOCKTOP, $GUI_DOCKBottom)) GUICtrlSetResizing($idCan_Button, BitOR($GUI_DOCKBottom, $GUI_DOCKHEIGHT, $GUI_DOCKWIDTH)) GUICtrlSetResizing($idSel_Button, BitOR($GUI_DOCKBottom, $GUI_DOCKHEIGHT, $GUI_DOCKWIDTH)) If Not FileExists($sAutoItPath & 'autoit3.exe') Then $sAutoItPath = '' If MsgBox($MB_YESNO, 'Ordner nicht gefunden', 'Möchten Sie selbst danach suchen?', 0, $hGui) = 6 Then $sAutoItPath = FileSelectFolder('AutoIt Ordner manuell suchen', 'c:\') EndIf If $sAutoItPath = '' Then Exit EndIf $idRoot = _GUICtrlTreeView_Add($idTV, 0, $sAutoItPath, $FOLDER_ICON_INDEX) $aDirs = _FileListToArray($sAutoItPath, '*', 2) If Not @error Then For $i = 1 To $aDirs[0] ; Add items _GUICtrlTreeView_AddChild($idTV, $idRoot, $aDirs[$i], $FOLDER_ICON_INDEX, $FOLDER_ICON_INDEX) Next EndIf $aFiles = _FileListToArray($sAutoItPath, '*', 1) If Not @error Then For $i = 1 To $aFiles[0] ; Add items $hIcon = _GUIImageList_GetFileIconIndex($aFiles[$i], True) _GUICtrlTreeView_AddChild($idTV, $idRoot, $aFiles[$i], $hIcon) ;,$hIcon) Next EndIf _GUICtrlTreeView_Expand($idTV) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() ; Author: progandy (www.autoit.de) Func _GUIImageList_GetSystemImageList($bLargeIcons = False) Local $dwFlags, $hIml, $FileInfo = DllStructCreate($tagSHFILEINFO) $dwFlags = BitOR($SHGFI_USEFILEATTRIBUTES, $SHGFI_SYSICONINDEX) If Not ($bLargeIcons) Then $dwFlags = BitOR($dwFlags, $SHGFI_SMALLICON) EndIf ;~ '// Load the image list - use an arbitrary file extension for the ;~ '// call to SHGetFileInfo (we don't want to touch the disk, so use ;~ '// FILE_ATTRIBUTE_NORMAL && SHGFI_USEFILEATTRIBUTES). $hIml = _WinAPI_SHGetFileInfo(".txt", $FILE_ATTRIBUTE_NORMAL, _ DllStructGetPtr($FileInfo), DllStructGetSize($FileInfo), $dwFlags) Return $hIml EndFunc ;==>_GUIImageList_GetSystemImageList ; Author: progandy (www.autoit.de) Func _WinAPI_SHGetFileInfo($pszPath, $dwFileAttributes, $psfi, $cbFileInfo, $uFlags) Local $return = DllCall("shell32.dll", "dword_ptr", "SHGetFileInfo", "str", $pszPath, "DWORD", $dwFileAttributes, "ptr", $psfi, "UINT", $cbFileInfo, "UINT", $uFlags) If @error Then Return SetError(@error, 0, 0) Return $return[0] EndFunc ;==>_WinAPI_SHGetFileInfo ; Author: progandy (www.autoit.de) Func _GUIImageList_GetFileIconIndex($sFileSpec, $bLargeIcons = False, $bForceLoadFromDisk = False) Local $dwFlags, $FileInfo = DllStructCreate($tagSHFILEINFO) $dwFlags = $SHGFI_SYSICONINDEX If $bLargeIcons Then $dwFlags = BitOR($dwFlags, $SHGFI_LARGEICON) Else $dwFlags = BitOR($dwFlags, $SHGFI_SMALLICON) EndIf ;~ ' We choose whether to access the disk or not. If you don't ;~ ' hit the disk, you may get the wrong icon if the icon is ;~ ' not cached. But the speed is very good! If Not $bForceLoadFromDisk Then $dwFlags = BitOR($dwFlags, $SHGFI_USEFILEATTRIBUTES) ;~ ' sFileSpec can be any file. You can specify a ;~ ' file that does not exist and still get the ;~ ' icon, for example sFileSpec = "C:\PANTS.DOC" Local $lR = _WinAPI_SHGetFileInfo( _ $sFileSpec, $FILE_ATTRIBUTE_NORMAL, DllStructGetPtr($FileInfo), DllStructGetSize($FileInfo), _ $dwFlags _ ) If ($lR = 0) Then Return SetError(1, 0, -1) Else Return DllStructGetData($FileInfo, "iIcon") EndIf EndFunc ;==>_GUIImageList_GetFileIconIndex 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