Sign in to follow this  
Followers 0
Kreatorul

Drag gui

6 posts in this topic

How can I make a dragable gui? I have something from a script..but it isn't working..any ideas?

Share this post


Link to post
Share on other sites



Use an ExStyle

$GUI_WS_EX_PARENTDRAG

Allow the label or pic control to be used as the title bar to drag the whole the parent window.

:)

Share this post


Link to post
Share on other sites

Not sure. I cannot get it to move either... :)

Share this post


Link to post
Share on other sites

Hello,

I can drag it, by using the event $GUI_EVENT_PRIMARYDOWN and $GUI_EVENT_PRIMARYUP :

#include <GUIConstants.au3>

GuiSetState()
$my_gui = GUICreate("Key", 147, 90, -1, -1, $WS_POPUP,$WS_EX_TOPMOST + $WS_EX_TOOLWINDOW + $GUI_WS_EX_PARENTDRAG)

GUISetState ()
While 1
    $msg=GuiGetMsg()
    If $msg=$Gui_event_close Then exitloop
    If $msg=$GUI_EVENT_PRIMARYDOWN Then windrag()
WEnd
 
func windrag()
    $posw=WinGetPos("Key")
    $poss=MouseGetPos()
    $deltax=$poss[0]-$posw[0]
    $deltay=$poss[1]-$posw[1]
    Do
        $msg = GUIGetMsg()
    Until $msg==$GUI_EVENT_PRIMARYUP
    $pos=MouseGetPos()
    WinMove("Key","",$pos[0]-$deltax,$pos[1]-$deltay)
EndFunc

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