Function Reference

GUICtrlSetPos

Changes the position of a control within the GUI window.

GUICtrlSetPos ( controlID, left, top [, width [, height]] )

 

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.
left The left side of the control.
top The top of the control.
width [optional] The width of the control.
height [optional] The height of the control .

 

Return Value

Success: Returns 1.
Failure: Returns 0.

 

Remarks

None.

 

Related

GUICtrlCreate...

 

Example


#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $right, $label, $button, $msg
   
    GUICreate("My GUI position")  ; will create a dialog box that when displayed is centered

    $right = 0
    $label = GUICtrlCreateLabel("my moving label", 10, 20)
   
    $button = GUICtrlCreateButton("Click to close", 50, 50)
    GUICtrlSetState(-1, $GUI_FOCUS)     ; the focus is on this button

    GUISetState()

    While 1
        $msg = GUIGetMsg()

        If $msg = $button Or $msg = $GUI_EVENT_CLOSE Then Exit
        If $right = 0 Then
            $right = 1
            GUICtrlSetPos($label, 20, 20)
        Else
            $right = 0
            GUICtrlSetPos($label, 10, 20)
        EndIf
        Sleep(100)
    WEnd
EndFunc   ;==>Example