Jump to content

Recommended Posts

Posted

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!

Catturaio.PNG

Catturaoi.PNG

Posted (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.

#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 by ad777

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

  • Moderators
Posted (edited)

ad777,

Why go to all that completely unnecessary trouble when GUICtrlSetResizing allows Windows to do all the work for you?

M23

Edited by Melba23
Speeling

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...