atomman Posted December 29, 2007 Share Posted December 29, 2007 Edit1 is a static width (used for line numbering) Edit2 and 3 are dynamic and resize with the GUI The problem is that the space between Edit1 and 2 grows/shrinks when you resize the GUI horizontally and it looks like hell. Edit1 is docked top, left, bottom Edit2 is docked top, right, bottom I would like to do this in such a way that it is still editable in Koda (4 GUI's in 1 script and they all get changed a lot). #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 215, 137, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) $Button1 = GUICtrlCreateButton("Button1", 8, 4, 75, 25, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $Edit1 = GUICtrlCreateEdit("", 3, 36, 29, 100, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN), 0) GUICtrlSetData(-1, "Edit1") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) $Edit2 = GUICtrlCreateEdit("", 33, 36, 90, 100) GUICtrlSetData(-1, "Edit2") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) $Edit3 = GUICtrlCreateEdit("", 124, 36, 90, 100) GUICtrlSetData(-1, "Edit3") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
martin Posted December 29, 2007 Share Posted December 29, 2007 I think that if you want to have both edits change width as the window width changes, and keep a fixed gap between them then you will have to write some code to deal with it. Which means I can't see how else to do it. I would set the width of edit2 to be fixed and dock the left and right for edit3 so that when it was resized they still looked neat and still used the full window width. Then have a small function for $WM_EXITSIZEMOVE to adjust the widths. This would not prevent the design being done in Koda. 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. Link to comment Share on other sites More sharing options...
atomman Posted December 30, 2007 Author Share Posted December 30, 2007 thank you martin. i will look into that. that's kind of what i thought was coming after seeing the examples of others, but i wanted to make sure there wasn't something simple in Koda i was missing. Link to comment Share on other sites More sharing options...
atomman Posted January 1, 2008 Author Share Posted January 1, 2008 (edited) @martin - i know what you were talking about, but i wasn't able to figure out how to implement it. This is what i came up with... it's dirty, but is works. Better ideas are welcome. #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 260, 112, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) $Edit1 = GUICtrlCreateEdit("", 0, 20, 33, 89, $ES_WANTRETURN) GUICtrlSetData(-1, "Edit1") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) $Edit2 = GUICtrlCreateEdit("", 36, 20, 109, 89) GUICtrlSetData(-1, "Edit2") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) $Edit3 = GUICtrlCreateEdit("", 148, 20, 109, 89) GUICtrlSetData(-1, "Edit3") GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYUP $fPos = WinGetPos($Form1) GUICtrlSetPos($Edit2, 36, 20, ($fPos[2] / 2) - 25) GUICtrlSetPos($Edit3, ($fPos[2] / 2) + 14, 20, ($fPos[2] / 2) - 25) EndSwitch WEnd Edited January 1, 2008 by atomman Link to comment Share on other sites More sharing options...
therks Posted January 1, 2008 Share Posted January 1, 2008 Not bad. How about something like this though? #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 260, 112, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) $Edit1 = GUICtrlCreateEdit("", 0, 20, 33, 89, $ES_WANTRETURN) GUICtrlSetData(-1, "Edit1") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) $Edit2 = GUICtrlCreateEdit("", 36, 20, 109, 89) GUICtrlSetData(-1, "Edit2") GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) $Edit3 = GUICtrlCreateEdit("", 148, 20, 109, 89) GUICtrlSetData(-1, "Edit3") GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, 'WM_SIZE') While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_SIZE($hWnd, $iMsg, $iWParam, $iLParam) Local $iWidth = BitAND($iLParam, 0xFFFF) Local $iHeight = BitShift($iLParam, 16) $iWidth -= 36 ; Do this so that when dividing in half it's not taking the width of the numbering column into account. GUICtrlSetPos($Edit2, 36, 20, ($iWidth / 2), $iHeight - 25) GUICtrlSetPos($Edit3, ($iWidth / 2) + 39, 20, ($iWidth / 2) - 3, $iHeight - 25) Return $GUI_RUNDEFMSG EndFunc You may need to tweak the numbers though. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
atomman Posted January 2, 2008 Author Share Posted January 2, 2008 utterly perfect! and yeah, i will have to tweak the numbers cause that's just a demo GUI, but that's not a problem. thank you Saunders! Link to comment Share on other sites More sharing options...
Sundance Posted February 8, 2008 Share Posted February 8, 2008 Hiho, little question. Is there a way to surpress the flickering when movin the GUI? Like waiting for the next screensync or something? greetz Sundance 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