Jump to content

Recommended Posts

Posted (edited)

Here is a script, excerpted from a much longer script:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
Local $iResizable = 0x80CC0000 ; BitOR($WS_POPUPWINDOW, $WS_CAPTION, $WS_SIZEBOX)
Local $iExStyle = 0x02000000 ; $WS_EX_COMPOSITED
Local $iWid=400,$iHt=500
GUICreate('test', $iWid,$iHt,100,100,$iResizable,$iExStyle)
Local $cBtnNewFolder = GUICtrlCreateLabel('New folder',10, 10, 54, 17,$SS_NOTIFY)   ; frameless button
Local $cBtnDelFolder = GUICtrlCreateLabel("Delete folder",74,10,65,17, $SS_NOTIFY)
Local $cBtnRenameFolder = GUICtrlCreateLabel("Rename folder",146,10,73,17, $SS_NOTIFY)
Local $cTreeView = GUICtrlCreateTreeView(10,30,$iWid-20,$iHt-80)

Local $iButton_Width = Int(($iWid - 50) / 4)
If $iButton_Width > 80 Then $iButton_Width = 80
If $iButton_Width < 50 Then $iButton_Width = 50

Local $cBtnSelect = GUICtrlCreateButton("Select", $iWid-($iButton_Width+10)*2,$iHt-38,$iButton_Width,30)
Local $cBtnCancel = GUICtrlCreateButton("Cancel", $iWid -($iButton_Width+10),$iHt-38,$iButton_Width,30)
Local $cLblInfo = GUICtrlCreateLabel('',20,$iHt-30,200,17)

GUICtrlSetResizing($cBtnNewFolder,$GUI_DOCKLEFT+$GUI_DOCKRIGHT + $GUI_DOCKTOP+$GUI_DOCKBOTTOM)

GUICtrlSetResizing($cTreeView, $GUI_DOCKLEFT+$GUI_DOCKRIGHT + $GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetResizing($cBtnCancel,$GUI_DOCKWIDTH               + $GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM)
GUICtrlSetResizing($cBtnSelect,$GUI_DOCKWIDTH               + $GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM)
GUICtrlSetResizing($cLblInfo,  $GUI_DOCKWIDTH               + $GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM)
GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg()=-3 Then
        ExitLoop
    EndIf
WEnd

As I reduce the height of the window,

  • long before I think it should, the New folder "button" disappears. 
  • The Delete Folder and Rename Folder "buttons" rise closer to the title bar

How can I keep the distance from the bottom of the title bar and the top of the treeview constant?

I did not find the Help particularly helpful. I must be missing something.

Edited by c.haslam
  Reveal hidden contents

 

Posted

I think $GUI_DOCKALL is what you need.

 

GUICtrlSetResizing($cBtnNewFolder,$GUI_DOCKALL)
GUICtrlSetResizing($cBtnDelFolder,$GUI_DOCKALL)
GUICtrlSetResizing($cBtnRenameFolder,$GUI_DOCKALL)
 

 

Saludos

Posted (edited)

Your suggestion seems to improve things.

I am thinking:

  • Without GUICtrlResizing() applied to any of the controls, the controls move proportionately as the window is made taller/shorter.
  • ???

This may be obvious: when the height of the window is changed, only the height of the treeview should change.

Edited by c.haslam
  Reveal hidden contents

 

Posted (edited)

Here is my solution:

GUICtrlSetResizing($cBtnNewFolder,$GUI_DOCKHEIGHT+$GUI_DOCKTOP) ; row of fixed-height controls
GUICtrlSetResizing($cBtnDelFolder,$GUI_DOCKHEIGHT+$GUI_DOCKTOP)
GUICtrlSetResizing($cBtnRenameFolder,$GUI_DOCKHEIGHT+$GUI_DOCKTOP)
; variable-height control whose top is always the same distance from the title bar
GUICtrlSetResizing($cTreeView, $GUI_DOCKTOP+$GUI_DOCKBOTTOM)    
; row of fixed-height controls below the treeview; distance from bottom of treeview to bottom of window is constant
GUICtrlSetResizing($cBtnCancel,$GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM) 
GUICtrlSetResizing($cBtnSelect,$GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM)
GUICtrlSetResizing($cLblInfo,  $GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM)

I show only the vertical (y) constants. The horizontal (x) constants are unchanged. I am yet to master GuiCtrlSetResizing() !

Edited by c.haslam
  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...