Sign in to follow this  
Followers 0
ILLBeBack

$GUI_DOCKBottom resizing behavior when adding menus.

3 posts in this topic

When a menu is fist added, GUI controls with $GUI_DOCKBottom resizing are relocated downward by the height of one menu row, even when there are multiple menu rows. If even more menus are added, requiring another row, the Bottom Docked controls do not continue to move downward.

The script below demonstrates this behavior. Make note of the location of the 'Add Menu' button and click it. Notice that all buttons, and the label, move downward, but the 'Add Menu' button, which is $GUI_Dock_Bottom, does not move as much. Click the button a second time, and, while the $GUI_Dock_Top buttons move downward, this button does not move.

Change the Docking using the top 2 buttons to see what happens with different scenarios.

Is this how bottom docking should work? I find nothing about this in the documentation, this forum, or in the bug reports.

; _Test_Resizing_when_adding_Menu.au3

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

GUICreate("Test Resize when adding Menu", 300, 400, -1, -1, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $ws_maximizebox))
$iDockTop = GUICtrlCreateButton("Dock Top", 10, 0, 100, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTop + $GUI_DOCKSIZE)
$iDockBottom = GUICtrlCreateButton("Dock Bottom", 190, 0, 100, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTop + $GUI_DOCKSIZE)

$iAddMenu = GUICtrlCreateButton("Add Menu" & @LF & "Docked at Bottom", 50, 60, 200, 45, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_MULTILINE))
GUICtrlSetResizing($iAddMenu, $GUI_DOCKLEFT + $GUI_DOCKBottom + $GUI_DOCKSIZE)


$sNote = "When a menu is fist added, GUI controls with $GUI_DOCKBottom resizing are relocated downward by the height of one menu row, even when there are multiple menu rows. If even more menus are added, requiring another row, the Bottom Docked controls do not continue to move downward." & @LF & @LF & _
"Make note of the location of the 'Add Menu' button and click it. Notice that all buttons, and the label, move downward, but the 'Add Menu' button, which is Dock_Bottom, does not move as much. Click the button a second time, and, while the Dock_Top buttons move downward, this button does not move. " & @LF & @LF & _
"Change the Docking using the top 2 buttons to see what happens with different scenarios."

GUICtrlCreateLabel($sNote, 10, 115, 280, 280)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTop + $GUI_DOCKSIZE)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
      ExitLoop
    ElseIf $msg = $iDockTop Then
        GUICtrlSetResizing($iAddMenu, $GUI_DOCKLEFT + $GUI_DOCKtop + $GUI_DOCKSIZE)
        GUICtrlSetData($iAddMenu, "Add Menu" & @LF & "Docked at Top")
    ElseIf $msg = $iDockBottom Then
        GUICtrlSetResizing($iAddMenu, $GUI_DOCKLEFT + $GUI_DOCKBottom + $GUI_DOCKSIZE)
        GUICtrlSetData($iAddMenu, "Add Menu" & @LF & "Docked at Bottom")
    ElseIf $msg = $iAddMenu Then
        GUICtrlCreateMenu("Menu 1")
        GUICtrlCreateMenu("Menu 2")
        GUICtrlCreateMenu("Menu 3")
        GUICtrlCreateMenu("Menu 4")
        GUICtrlCreateMenu("Menu 5")
        GUICtrlCreateMenu("Menu 6")
        GUICtrlCreateMenu("Menu 7")
        GUICtrlCreateMenu("Menu 8")
    EndIf
WEnd
Exit

Share this post


Link to post
Share on other sites



When a menu is fist added, GUI controls with $GUI_DOCKBottom resizing are relocated downward by the height of one menu row, even when there are multiple menu rows. If even more menus are added, requiring another row, the Bottom Docked controls do not continue to move downward.

The script below demonstrates this behavior. Make note of the location of the 'Add Menu' button and click it. Notice that all buttons, and the label, move downward, but the 'Add Menu' button, which is $GUI_Dock_Bottom, does not move as much. Click the button a second time, and, while the $GUI_Dock_Top buttons move downward, this button does not move.

Change the Docking using the top 2 buttons to see what happens with different scenarios.

Is this how bottom docking should work? I find nothing about this in the documentation, this forum, or in the bug reports.

; _Test_Resizing_when_adding_Menu.au3

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

GUICreate("Test Resize when adding Menu", 300, 400, -1, -1, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $ws_maximizebox))
$iDockTop = GUICtrlCreateButton("Dock Top", 10, 0, 100, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTop + $GUI_DOCKSIZE)
$iDockBottom = GUICtrlCreateButton("Dock Bottom", 190, 0, 100, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTop + $GUI_DOCKSIZE)

$iAddMenu = GUICtrlCreateButton("Add Menu" & @LF & "Docked at Bottom", 50, 60, 200, 45, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_MULTILINE))
GUICtrlSetResizing($iAddMenu, $GUI_DOCKLEFT + $GUI_DOCKBottom + $GUI_DOCKSIZE)


$sNote = "When a menu is fist added, GUI controls with $GUI_DOCKBottom resizing are relocated downward by the height of one menu row, even when there are multiple menu rows. If even more menus are added, requiring another row, the Bottom Docked controls do not continue to move downward." & @LF & @LF & _
"Make note of the location of the 'Add Menu' button and click it. Notice that all buttons, and the label, move downward, but the 'Add Menu' button, which is Dock_Bottom, does not move as much. Click the button a second time, and, while the Dock_Top buttons move downward, this button does not move. " & @LF & @LF & _
"Change the Docking using the top 2 buttons to see what happens with different scenarios."

GUICtrlCreateLabel($sNote, 10, 115, 280, 280)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTop + $GUI_DOCKSIZE)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
    ExitLoop
    ElseIf $msg = $iDockTop Then
        GUICtrlSetResizing($iAddMenu, $GUI_DOCKLEFT + $GUI_DOCKtop + $GUI_DOCKSIZE)
        GUICtrlSetData($iAddMenu, "Add Menu" & @LF & "Docked at Top")
    ElseIf $msg = $iDockBottom Then
        GUICtrlSetResizing($iAddMenu, $GUI_DOCKLEFT + $GUI_DOCKBottom + $GUI_DOCKSIZE)
        GUICtrlSetData($iAddMenu, "Add Menu" & @LF & "Docked at Bottom")
    ElseIf $msg = $iAddMenu Then
        GUICtrlCreateMenu("Menu 1")
        GUICtrlCreateMenu("Menu 2")
        GUICtrlCreateMenu("Menu 3")
        GUICtrlCreateMenu("Menu 4")
        GUICtrlCreateMenu("Menu 5")
        GUICtrlCreateMenu("Menu 6")
        GUICtrlCreateMenu("Menu 7")
        GUICtrlCreateMenu("Menu 8")
    EndIf
WEnd
Exit

If the button has $GUI_DOCKBOTTOM then it would be understandable if it didn't ever move relative to the bottom. Then again, if you add a menu you normally need all the controls to move down. I have a similar problems with Koda where a control with DOCKBOTTOM is out of position at run time because there is a main menu and I had to make a work-around. I would agree that the behaviour is a bit strange but I don't regard it as a bug because in my view there are conflicting requirements and if something unexpected happens then it is to be expected. Presumably adding one menu height was allowed for but not more.

Others might disagree.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

If the button has $GUI_DOCKBOTTOM then it would be understandable if it didn't ever move relative to the bottom. Then again, if you add a menu you normally need all the controls to move down. I have a similar problems with Koda where a control with DOCKBOTTOM is out of position at run time because there is a main menu and I had to make a work-around. I would agree that the behaviour is a bit strange but I don't regard it as a bug because in my view there are conflicting requirements and if something unexpected happens then it is to be expected. Presumably adding one menu height was allowed for but not more.

Others might disagree.

Thanks for your reply.

Yep, it’s not a bug if it behaves the way the programmer intended, even if I think it shouldn’t behave that way or if it behaves inconsistently!

Perhaps the real issue is the Client Size is being reduced in height instead of retaining its height and moving downward to accommodate the menu, which of course would increase the GUI size. If done that way, the docking rules could always be obeyed.

To borrow a quote, "Others might disagree"!

Share this post


Link to post
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
Sign in to follow this  
Followers 0