Terenz Posted February 1, 2016 Share Posted February 1, 2016 (edited) The code #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $hGUI = GUICreate("TEST", 300, 300, -1, -1, $WS_SIZEBOX + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) Global $aGUI = WinGetClientSize($hGUI) If @error Or Not IsArray($aGUI) Then Exit Global $hChild = GUICreate("", $aGUI[0], $aGUI[1], 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFF0000, $hChild) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hChild) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIDelete($hGUI) GUIDelete($hChild) Exit EndSwitch EndSwitch WEnd The result: As you can see is not aligned or is the same size of the inside of the parent gui, the expected result. How to solve? After solved that, the second part is resize the child if the parent is resized. Thanks Edited February 2, 2016 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 February 1, 2016 Moderators Share Posted February 1, 2016 Terenz, I have seen this before with resizable GUIs - it seems that the increased border size interferes with the child GUI location. I will look into it and see if I can come up with a work-a-round. 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...
Moderators Melba23 Posted February 1, 2016 Moderators Share Posted February 1, 2016 Terenz, Here you go: #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("TEST", 300, 300, Default, Default, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) GUISetBkColor(0x00FF00, $hGUI) GUISetState(@SW_SHOW, $hGUI) $iDiff = _WinAPI_GetSystemMetrics(7) - _WinAPI_GetSystemMetrics(32) ; Size frame - Fixed frame $aGUI = WinGetClientSize($hGUI) $hChild = GUICreate("", $aGUI[0], $aGUI[1], $iDiff, $iDiff, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFF0000, $hChild) GUISetState(@SW_SHOW, $hChild) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd And note how you should combine styles - the Setting Styles tutorial in the Wiki explains why this is the case. 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...
UEZ Posted February 1, 2016 Share Posted February 1, 2016 (edited) Does this fit: #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $hGUI = GUICreate("TEST", 300, 300, -1, -1, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) Global $aGUI = WinGetClientSize($hGUI) If @error Or Not IsArray($aGUI) Then Exit Global $hChild = GUICreate("", $aGUI[0], $aGUI[1], 0, 0, $WS_CHILD, $WS_EX_MDICHILD) GUISetBkColor(0xFF0000, $hChild) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hChild) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_SIZE, "") GUIDelete($hGUI) GUIDelete($hChild) Exit EndSwitch EndSwitch WEnd Or this one: expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $iDelta = 10 ;just to show resizing Global $hGUI = GUICreate("TEST", 300, 300, -1, -1, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) Global $aGUI = WinGetClientSize($hGUI) If @error Or Not IsArray($aGUI) Then Exit GUISetBkColor(0xFF00FF, $hGUI) Global $hChild = GUICreate("test2", $aGUI[0] - $iDelta, $aGUI[1] - $iDelta, 0, 0, $WS_CHILD, -1, $hGUI) GUISetBkColor(0xFF0000, $hChild) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hChild) GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_SIZE, "") GUIDelete($hGUI) GUIDelete($hChild) Exit EndSwitch EndSwitch WEnd Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam Switch $hWnd Case $hGUI Local $tRect = _WinAPI_GetClientRect($hWnd) WinMove($hChild, "", $tRect.Left, $tRect.Top, _WinAPI_LoWord($lParam) - $iDelta, _WinAPI_HiWord($lParam) - $iDelta) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Modified the WM_SIZE code from InunoTaishou (next post)! Edited February 1, 2016 by UEZ Added 2nd version Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
InunoTaishou Posted February 1, 2016 Share Posted February 1, 2016 (edited) Looks like it's been solved already but I figured I'd throw this out there. Since you're going to be working with resizable GUI's, and only the main one is going to be resized (at least in the example given), check out the WM_SIZE message for keeping the child in the client area GUIRegisterMsg($WM_SIZE, "WM_SIZE") Func WM_SIZE($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam, $lParam Local $iWidth = _WinAPI_LoWord($lParam) Local $iHeight = _WinAPI_HiWord($lParam) Local $tRect = _WinAPI_GetClientRect($hWndFrom) If ($hWndFrom = $hGUI) Then _WinAPI_ClientToScreen($hWndFrom, $tRect) WinMove($hChild, "", DllStructGetData($tRect, "Left"), DllStructGetData($tRect, "Top"), $iWidth, $iHeight) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE This just resizes the child to always fit the size of the parent but you can use it to resize the child when the main is too big or too small. Edited February 1, 2016 by InunoTaishou Link to comment Share on other sites More sharing options...
Terenz Posted February 2, 2016 Author Share Posted February 2, 2016 Thanks guys, is all clear now 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