Jump to content
Sign in to follow this  
TinyHacker

Drag a "button" to move the window?!

Recommended Posts

TinyHacker

Hello bros!

Can u please tell me how can i make the "button" and the "pic" able to move the window when i drag them?

i mean to let the "button" and the "pic" just like the "window frame" can move the window by dragging them!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Help!", 153, 148, 279, 169)
$Button1 = GUICtrlCreateButton("drag me to move the window", 8, 24, 137, 49, BitOR($BS_MULTILINE,$WS_GROUP))
GUICtrlSetCursor (-1, 0)
$Pic1 = GUICtrlCreatePic("", 8, 88, 137, 49, BitOR($SS_NOTIFY,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

please it's important   :mellow: .... thanx!

Edited by TinyHacker

Share this post


Link to post
Share on other sites
Yoriz

Hi,

You can use '$GUI_WS_EX_PARENTDRAG', works on the label but i dont think it works on buttons.

For the button you might have to do some detect a mouseleftdown and if mouse moves before mouseleftup then move the window to follow mouse, else carryout button click im just guessing on how you could do it though :mellow: .

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

#Region ### START Koda GUI section ### $Form=
$Form2 = GUICreate("Help!", 153, 148, 279, 169)
$Button1 = GUICtrlCreateButton("drag me to move the window", 8, 24, 137, 49, BitOR($BS_MULTILINE,$WS_GROUP),$GUI_WS_EX_PARENTDRAG)
GUICtrlSetCursor (-1, 0)
$Pic1 = GUICtrlCreatePic("", 8, 88, 137, 49, BitOR($SS_NOTIFY,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS),$GUI_WS_EX_PARENTDRAG)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites
TinyHacker

Thank u   Yoriz !! :mellow:

Ya it really worked as i wanted it to be!  :P, no need to do the same with the button, than's enough for me thanx bro! Posted Image

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.