buymeapc Posted March 2, 2017 Share Posted March 2, 2017 I have a GUI that has a few controls on it and when I double-click on the window edge to maximize it in either direction, like if I double-click the top edge of the GUI, it maximizes vertically, but the width remains the same. Some controls move accordingly with the window resizing, but others do not. In my repro, I just have a simple button control that has a TOP setting as 188. When I double-click the top edge of the GUI, on my screen, the control moves to 380 even though I want it to remain at 188. How can I prevent the control from moving and keep it at the setting of 188? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $g__iButtonPos = 188; <<<<<<<<<<< Where I want the control to remain $hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX)) $idButton = GUICtrlCreateButton("Test", 200, $g__iButtonPos, 100, 20) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) $aPos = ControlGetPos($hGUI, "", $idButton) If $aPos[1] <> $g__iButtonPos Then ConsoleWrite("!> WRONG: This is not equal to $g__iButtonPos: " & $aPos[1] & @CRLF) Else ConsoleWrite("+> CORRECT: This is equal to $g__iButtonPos: " & $aPos[1] & @CRLF) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Link to comment Share on other sites More sharing options...
mikell Posted March 2, 2017 Share Posted March 2, 2017 You might have a look at GUICtrlSetResizing Link to comment Share on other sites More sharing options...
buymeapc Posted March 4, 2017 Author Share Posted March 4, 2017 I found some issues with my manual resizing in my main script, but this was key in fixing the issue. Thanks mikell!! 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