amin84 Posted June 22, 2012 Share Posted June 22, 2012 Hello, I'm having a little bit of problem with making a resizeable GUI. In this GUI there are two GUICtrlEdits top to bottom with about 12 pixels apart from each other. I want the top GUICtrlEdit to be pinned @ 38 from top and the bottom GUICtrlEdit to be pinned @ 8 from bottom. Now when I maximize the top GUICtrlEdit is pinned at top and the bottom GUICtrlEdit is pinned at bottom correctly but the 12 pixels space between them gets bigger. This is the code I have: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $mainGuiW = 410, $mainGuiH = 202 #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", $mainGuiW, $mainGuiH, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Edit1 = GUICtrlCreateEdit("", 8, 8+30, 393, $mainGuiH/2-30, BitOR($ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "Edit1") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP) $Edit2 = GUICtrlCreateEdit("", 8, 104+15, 393, $mainGuiH/2-30, BitOR($ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM) GUICtrlSetData(-1, "Edit2") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Any help is appreciated. Link to comment Share on other sites More sharing options...
UEZ Posted June 22, 2012 Share Posted June 22, 2012 (edited) Try this: expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $mainGuiW = 410, $mainGuiH = 202 #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", $mainGuiW, $mainGuiH, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Edit1 = GUICtrlCreateEdit("", 8, 8+30, 393, $mainGuiH/2-30, BitOR($ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "Edit1") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP) $Edit2 = GUICtrlCreateEdit("", 8, 104+15, 393, $mainGuiH/2-30, BitOR($ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM) GUICtrlSetData(-1, "Edit2") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_SIZING, "WM_SIZING") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_SIZING, "") GUIDelete() Exit Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE ResizeCtrl() EndSwitch WEnd Func ResizeCtrl() Local $aPosCtrl = ControlGetPos($Form3, "", $Edit1) Local $aPosWin = WinGetPos($Form3) Local Const $iConst = 50 ;8 + 30 + 12 Local $ypos = $aPosCtrl[3] + $iConst GUICtrlSetPos($Edit2, 8, $ypos, $aPosCtrl[2], $aPosWin[3] - $ypos - $iConst) EndFunc Func WM_SIZING($hWnd, $Msg, $wParam, $lParam) ResizeCtrl() Return $GUI_RUNDEFMSG EndFunc Br, UEZ Edited June 22, 2012 by UEZ 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...
amin84 Posted June 22, 2012 Author Share Posted June 22, 2012 Awesome. The snapping window to the top (maximize) didn't work n I added $GUI_EVENT_RESTORE to Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED and that part works. But if you drag the maximized window to centre of the screen (to restore it) it still won't work. I couldn't find any GUI_EVENT to fix that part. Link to comment Share on other sites More sharing options...
UEZ Posted June 22, 2012 Share Posted June 22, 2012 Change GUIRegisterMsg($WM_SIZE, "WM_SIZE") to GUIRegisterMsg($WM_SIZING, "WM_SIZING") and it should work. I update the code. Br, UEZ 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...
amin84 Posted June 23, 2012 Author Share Posted June 23, 2012 Dude, Tnx. It just needs $GUI_EVENT_RESIZED at the end of line 24 and snap will work perfect. Tnx again. 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