Jump to content

WinMove


oMBRa
 Share

Recommended Posts

here is my code:

#include <GUIConstantsEx.au3>

$window = GUICreate('GUI', 200, 100)
$button = GUICtrlCreateButton('click', 50, 50)
$button2 = GUICtrlCreateButton('button', 250, 50)
GUISetState()
Global $state = False
While 1
    $msg = GUIGetMsg()
    If $msg = $button Then
        $state = Not $state
        If $state = True Then
            WinMove($window, '', Default, Default, 350)
        ElseIf $state = False Then
            WinMove($window, '', Default, Default, 200)
        EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
WEnd

why ''button2'' doesnt appear?

Link to comment
Share on other sites

because the gui is 200 pix in width and the button starts at 250pix from left.

:mellow:

You didn't set a resizing, so the ctrls are moved.

#include <GUIConstantsEx.au3>

$window = GUICreate('GUI', 200, 100)
$button = GUICtrlCreateButton('click', 50, 50)
GUICtrlSetResizing(-1, 802)
$button2 = GUICtrlCreateButton('button', 250, 50)
GUICtrlSetResizing(-1, 802)
GUISetState()
Global $state = False
While 1
    $msg = GUIGetMsg()
    If $msg = $button Then
        $state = Not $state
        If $state = True Then
            WinMove($window, '', Default, Default, 350)
        ElseIf $state = False Then
            WinMove($window, '', Default, Default, 200)
        EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
WEnd
Edited by senthor
Link to comment
Share on other sites

There was a slide-in/out script I saw a while back, why not look it up? Also I doubt that the button will be drawn at any point unless you draw it after resizing the window.

Link to comment
Share on other sites

You didn't set a resizing, so the ctrls are moved.

#include <GUIConstantsEx.au3>

$window = GUICreate('GUI', 200, 100)
$button = GUICtrlCreateButton('click', 50, 50)
GUICtrlSetResizing(-1, 802)
$button2 = GUICtrlCreateButton('button', 250, 50)
GUICtrlSetResizing(-1, 802)
GUISetState()
Global $state = False
While 1
    $msg = GUIGetMsg()
    If $msg = $button Then
        $state = Not $state
        If $state = True Then
            WinMove($window, '', Default, Default, 350)
        ElseIf $state = False Then
            WinMove($window, '', Default, Default, 200)
        EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
WEnd
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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