Kyan Posted March 7, 2013 Posted March 7, 2013 (edited) Hi everyone I have a problem resizing a window when a other tab is selected, the problem is not in resizing it but to keep the windows in the same position here's a example: #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 386, 274) $Tab1 = GUICtrlCreateTab(0, 0, 385, 273) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") GUICtrlSetState(-1, $GUI_SHOW) $input1 = GUICtrlCreateInput("Click in here", 60, 34, 100, 22) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 $pos = WinGetCaretPos() If GUICtrlRead($Tab1) = 0 Then WinMove($Form1, "", $pos[0] - 3, $pos[1] - 25, 386, 274) GUICtrlSetPos($Tab1, -1, -1, 386, 274) ElseIf GUICtrlRead($Tab1) = 1 Then WinMove($Form1, "", $pos[0] - 3, $pos[1] - 25, 276, 300) GUICtrlSetPos($Tab1, -1, -1, 276, 300) EndIf EndSwitch WEnd As you can see/test, if you change tab without clicking in a control (input1) the window will be resized without moving, but if you click/input in a control it starts moving Any tips? Edited March 7, 2013 by DiOgO Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
jdelaney Posted March 7, 2013 Posted March 7, 2013 (edited) use wingetpos: #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 386, 274) $Tab1 = GUICtrlCreateTab(0, 0, 385, 273) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") GUICtrlSetState(-1, $GUI_SHOW) $input1 = GUICtrlCreateInput("Click in here", 60, 34, 100, 22) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 $pos = WinGetPos($Form1) If GUICtrlRead($Tab1) = 0 Then WinMove($Form1, "", $pos[0], $pos[1], 386, 274) GUICtrlSetPos($Tab1, -1, -1, 386, 274) ElseIf GUICtrlRead($Tab1) = 1 Then WinMove($Form1, "", $pos[0], $pos[1], 276, 300) GUICtrlSetPos($Tab1, -1, -1, 276, 300) EndIf EndSwitch WEnd edit: made it "tidy" Edited March 7, 2013 by jdelaney Kyan 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Kyan Posted March 7, 2013 Author Posted March 7, 2013 thanks jdelaney finally this works Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Kyan Posted March 9, 2013 Author Posted March 9, 2013 sorry for bringing this up, what could be the reasons for winmove() cannot resize? (handle and parameters all correct, I test it in a gui without any stuff) Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Moderators Melba23 Posted March 9, 2013 Moderators Posted March 9, 2013 DiOgO, You have been here long enough to know we need to see some code which demonstrates the problem, otherwise we cannot really help you. 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
Kyan Posted March 9, 2013 Author Posted March 9, 2013 DiOgO,You have been here long enough to know we need to see some code which demonstrates the problem, otherwise we cannot really help you. M23okey I tried to use just a variable to set expand or collapse and now works can you tell me de difference between WinGetPos() window size and GuiCreate()? I set a size on GUICreate and WinGetPos gives me another, is due the fact I have a Top Menu? (the one created with GUICtrlCreateMenu()) Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Moderators Melba23 Posted March 9, 2013 Moderators Posted March 9, 2013 DiOgO, can you tell me de difference between WinGetPos() window size and GuiCreate()?That one is easy! GUICreate creates a GUI with a client area of the requested size - the actual GUI is often larger because it usually has borders and a title bar. WinGetPos tells you the size of the whole GUI - but WinGetClientSize will return the originally requested values: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GUISetState() $aPos = WinGetPos($hGUI) $aClient = WinGetClientSize($hGUI) MsgBox(0, "Sizes", "Requested: 500 x 500" & @CRLF & "Full GUI: " & $aPos[2] & " x " & $aPos[3] & @CRLF & "Client: " & $aClient[0] & " x " & $aClient[1]) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd All clear now? 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
Kyan Posted March 9, 2013 Author Posted March 9, 2013 (edited) DiOgO, That one is easy! GUICreate creates a GUI with a client area of the requested size - the actual GUI is often larger because it usually has borders and a title bar. WinGetPos tells you the size of the whole GUI - but WinGetClientSize will return the originally requested values: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GUISetState() $aPos = WinGetPos($hGUI) $aClient = WinGetClientSize($hGUI) MsgBox(0, "Sizes", "Requested: 500 x 500" & @CRLF & "Full GUI: " & $aPos[2] & " x " & $aPos[3] & @CRLF & "Client: " & $aClient[0] & " x " & $aClient[1]) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd All clear now? M23 wow thanks Melba again now no problems in using the same size as the guicreate I didn't know about WinGetClientSize() function >_< Edited March 9, 2013 by DiOgO Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
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