Jump to content
Sign in to follow this  
benzrf

Moving a GUI

Recommended Posts

benzrf

Is there a way to move a GUI you created without using WinMove? It seems to me that WinMove is a bit sloppy (could register something else or glitch if you have two instances open?).

I can find numerous ways to move controls around in a GUI, but I can't figure out any way to move the GUI itself!

Share this post


Link to post
Share on other sites
JohnOne

It seems to me that WinMove is a bit sloppy (could register something else or glitch if you have two instances open?).

When you have a handle to your GUI I doubt it will "glitch" as windows cannot share the same handle.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
sleepydvdr

Is there a way to move a GUI you created without using WinMove? It seems to me that WinMove is a bit sloppy (could register something else or glitch if you have two instances open?).

I can find numerous ways to move controls around in a GUI, but I can't figure out any way to move the GUI itself!

What's sloppy about it? It is very precise. You can use WinGetPos to find it's current position and move it to a precise number of pixels in x and y coordinates. Example:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("My Window", 280, 180, -1, -1)
$Button1 = GUICtrlCreateButton("Move", 88, 64, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $currentPosition = WinGetPos("My Window")
            WinMove("My Window", "", $currentPosition[0] + 50, $currentPosition[1] - 50)
    EndSwitch
WEnd

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites
benzrf

Ohhhhhh... I didn't realize you could use a handle in WinMove. Thanks!

Share this post


Link to post
Share on other sites
Melba23

benzrf,

You can always use the handle in place of "title" in any native AutoIt function - but do not forget to set the "text" parameter to "" if you do. :)

M23


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

 

Share this post


Link to post
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
Sign in to follow this  

×