Clanity184 Posted April 13, 2022 Posted April 13, 2022 Hello, i have a problem with resizing the gui. When i do it, using WinMove, the buttons change their position. case $btnCast WinMove($Form1, "AutoBot",1180, 10, 380, 680) GUICtrlSetState ($ANU,$GUI_ENABLE) GUICtrlSetState ($GABRI,$GUI_ENABLE) GUICtrlSetState ($EXDATA,$GUI_ENABLE) GUICtrlSetState ($VOLSCA,$GUI_ENABLE) GUICtrlSetState ($VOL150,$GUI_ENABLE) case $btnCastE Thanks for help!
ad777 Posted April 14, 2022 Posted April 14, 2022 (edited) @Clanity184 i did make this code to help you below is script: Use _Get:to get info about class of window _Set:set Position of Button's that was get it from _Get. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 386, 102, 0, 0) $Button1 = GUICtrlCreateButton("Button1", 56, 40, 81, 33) $Button2 = GUICtrlCreateButton("Button2", 160, 40, 49, 25) $Button3 = GUICtrlCreateButton("Button3", 232, 40, 65, 25) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 280, 16, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 $output = _GET($Form1) WinMove($Form1, "", 0, 0, 380, 680) _SET($Form1, $output) EndSwitch WEnd Func _GET($Title) Local $inc, $inc2, $inc3, $inc4, $inc5, $inc6, $add $Win = WinGetClassList($Title) For $i = 1 To stringlen($Win) if StringMid($Win, $i, 1) = 'B' Then $inc = $inc + 1 EndIf Next For $i = 1 To $inc $PoxButton = ControlGetPos($Form1, '', 'Button' & $i)[0] $PoYButton = ControlGetPos($Form1, '', 'Button' & $i)[1] $add &= 'Button' & $i & ':X>' & $PoxButton & ':Y>' & $PoYButton & ',' Next ;; if StringMid($Win, $i, 1) = 'E' Then $inc2 = $inc2 + 1 EndIf For $i = 1 To $inc2 $PoxButton = ControlGetPos($Form1, '', 'Edit' & $i)[0] $PoYButton = ControlGetPos($Form1, '', 'Edit' & $i)[1] $add &= 'Edit' & $i & ':X>' & $PoxButton & ':Y>' & $PoYButton & ',' Next ;; if StringMid($Win, $i, 1) = 'S' Then $inc3 = $inc3 + 1 EndIf For $i = 1 To $inc3 $PoxButton = ControlGetPos($Form1, '', 'Static' & $i)[0] $PoYButton = ControlGetPos($Form1, '', 'Static' & $i)[1] $add &= 'Static' & $i & ':X>' & $PoxButton & ':Y>' & $PoYButton & ',' Next ;; if StringMid($Win, $i, 1) = 'ListBox' Then $inc4 = $inc4 + 1 EndIf For $i = 1 To $inc4 $PoxButton = ControlGetPos($Form1, '', 'ListBox' & $i)[0] $PoYButton = ControlGetPos($Form1, '', 'ListBox' & $i)[1] $add &= 'ListBox' & $i & ':X>' & $PoxButton & ':Y>' & $PoYButton & ',' Next ;;; if StringMid($Win, $i, 1) = 'ComboBox' Then $inc5 = $inc5 + 1 EndIf For $i = 1 To $inc5 $PoxButton = ControlGetPos($Form1, '', 'ComboBox' & $i)[0] $PoYButton = ControlGetPos($Form1, '', 'ComboBox' & $i)[1] $add &= 'ComboBox' & $i & ':X>' & $PoxButton & ':Y>' & $PoYButton & ',' Next ;;; if StringMid($Win, $i, 1) = 'msctls_progress32' Then $inc6 = $inc6 + 1 EndIf For $i = 1 To $inc6 $PoxButton = ControlGetPos($Form1, '', 'msctls_progress32' & $i)[0] $PoYButton = ControlGetPos($Form1, '', 'msctls_progress32' & $i)[1] $add &= 'msctls_progress32' & $i & ':X>' & $PoxButton & ':Y>' & $PoYButton & ',' Next Return $add & ']' ;;; EndFunc ;==>_GET Func _SET($Title, $output) Global $add_F, $add_F2, $add_F3, $add_F2, $add_F3, $STRRED, $add_1, $add_2, $add_3, $add_Lp, $add_Lp2, $add_Lp3, $RetNm While 1 For $i = $RetNm to 255 $STRRED = $output if StringMid($STRRED, $i, 1) = ':' Then For $i = $add_Lp + 4 to 255 $STRRED = $output if StringMid($STRRED, $i, 1) = ':' Then for $i = $add_Lp2 + 4 To 255 if StringMid($STRRED, $i, 1) = ',' Then ControlMove($Title, '', $add_1, $add_2, $add_3) if StringMid($STRRED, $i + 1, 1) = ']' Then ExitLoop 4 Else $RetNm = $add_Lp3 + 2 $add_F = '' $add_F2 = '' $add_F3 = '' ExitLoop 3 EndIf Else $anoth3 = StringMid($STRRED, $i, 1) $add_F3 &= $anoth3 $add_3 = $add_F3 $add_Lp3 = $i EndIf Next Else $anoth2 = StringMid($STRRED, $i, 1) $add_F2 &= $anoth2 $add_2 = $add_F2 $add_Lp2 = $i EndIf Next Else $anoth = StringMid($STRRED, $i, 1) $add_F &= $anoth $add_1 = $add_F $add_Lp = $i EndIf Next WEnd EndFunc ;==>_SET Edited April 14, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want.
Moderators Melba23 Posted April 14, 2022 Moderators Posted April 14, 2022 (edited) ad777, Why go to all that completely unnecessary trouble when GUICtrlSetResizing allows Windows to do all the work for you? M23 Edited April 14, 2022 by Melba23 Speeling 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
ad777 Posted April 14, 2022 Posted April 14, 2022 2 hours ago, Melba23 said: ad777, Why go to all that completely unnecessary trouble when GUICtrlSetResizing allows Windows to do all the work for you? M23 Sorry I did not notice that. iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want.
Clanity184 Posted April 15, 2022 Author Posted April 15, 2022 Thanks to all of you for the effors, GUICtrlSetResizing works fine for me.🙂
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