Terenz Posted November 23, 2014 Share Posted November 23, 2014 (edited) Guys, check this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Form 1", 636, 530, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) #region First Group GUICtrlCreateGroup("", 510, 456, 117, 50) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKSIZE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("", 8, 456, 498, 50) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) GUICtrlCreateGroup("", -99, -99, 1, 1) #endregion #region Second Group GUICtrlCreateGroup("", 8, 409, 268, 50) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("", 280, 409, 347, 50) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) GUICtrlCreateGroup("", -99, -99, 1, 1) #endregion GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Run and maximize the window. The space between the two groups of the #region Second Group is different from the normal window ( the first group instead is equal in both cases! ) and this is a problem for me because the control inside that group is misaligned and doesn't fit In this image, the "green" is the normal window of #region Second Group, in "red" when is maximized and you can see the difference in pixel: There is a way to solve or better align the groups? Thanks Edited November 23, 2014 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2014 Moderators Share Posted November 23, 2014 Terenz , this is a problem for me because the control inside that group is misaligned and doesn't fitSo why not get the actual size of the group and resize the control to fit? And you do realise that you have different resizing parameters for the 2 rows? So it is hardly surprising that they resize differently. I think you will have to resize the second group manually if you want the spacing to remain constant:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> $bResized = False $hGUI = GUICreate("Form 1", 636, 530, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetBkColor(0xCCffCC) #region First Group $cGroup_1 = GUICtrlCreateGroup("1", 510, 456, 117, 50) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKSIZE) ;GUICtrlCreateGroup("", -99, -99, 1, 1) ; No need if you immediately create another group $cGroup_2 = GUICtrlCreateGroup("2", 8, 456, 498, 50) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) ;GUICtrlCreateGroup("", -99, -99, 1, 1) #endregion #region Second Group $cGroup_3 = GUICtrlCreateGroup("3", 8, 409, 268, 50) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) ;GUICtrlCreateGroup("4", -99, -99, 1, 1) $cGroup_4 = GUICtrlCreateGroup("4", 280, 409, 347, 50) ;GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) GUICtrlCreateGroup("", -99, -99, 1, 1) ; But now you need it #endregion GUISetState(@SW_SHOW) ; Get spacing between 1 & 2 $aPos_1 = ControlGetPos($hGUI, "", $cGroup_1) $aPos_2 = ControlGetPos($hGUI, "", $cGroup_2) $iSpacing = $aPos_1[0] - ($aPos_2[0] + $aPos_2[2]) GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $bResized Then $aClient = WinGetClientSize($hGUI) $aPos_3 = ControlGetPos($hGUI, "", $cGroup_3) ; Set the same spacing Local $iX_4 = $aPos_3[0] + $aPos_3[2] + $iSpacing ; Determine correct width Local $iW_4 = $aClient[0] - $iX_4 - 10 ; Resize the control ControlMove($hGUI, "", $cGroup_4, $iX_4, $aPos_3[1], $iW_4, $aPos_3[3]) $bResized = False EndIf WEnd Func _WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) $bResized = True EndFuncBut you suprised us all yesterday with the "Maximize/Restore" button - see if you can do it again today! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Terenz Posted November 23, 2014 Author Share Posted November 23, 2014 (edited) Yes i know they have different resizing parameters. I don't think today i'll surprise you, the only thing i know is GUICtrlSetResizing is limited. I don't have idea how GUICtrlSetResizing work, the last avaible source of autoit don't have it. Anyway i'll post a couple of example of many, many optional parameter then the Resizing function miss: Automatic Layout of Resizable Dialogs Control Positioning and Sizing using a C++ Helper Class MFC/C++ Helper Class for Window Resizing From one of the article: "So far, the anchors of the controls always referred to the edges of the main dialog window. However, there are cases where this solution is not flexible enough" etc. P.S. In _WM_SIZE $bResized become True only when i'll release the mouse from the "manual" resizing, so ControlMove apply only when the resizing is finished, instead GUICtrlSetResizing is in "real time" Edited November 23, 2014 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength 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