FinalVersion Posted February 19, 2010 Posted February 19, 2010 Lets say I remove the title bar, how can I make the top 20px of the program drag able? [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
JRowe Posted February 19, 2010 Posted February 19, 2010 MouseCoordMode sets whether MouseGetPos() is relative or absolute. In this case, you want relative.Test MouseGetPos() whether its in the top 20 pixels when a mouse and the $GUI_EVENT_PRIMARYDOWN event on GuiGetMsg. If the two are true, use WinMove() to move your window along with the cursor.Good luck [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
FinalVersion Posted February 19, 2010 Author Posted February 19, 2010 Ok I got this far but I'm stuck with the WinMove(). #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MouseCoordMode", 2) $Form1 = GUICreate("Form1", 501, 344, 192, 124, BitOR($WS_POPUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $mPos = MouseGetPos() If $mPos[1] < 20 Then WinMove() ; I'm stuck here EndIf EndSwitch WEnd [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
Moderators Melba23 Posted February 19, 2010 Moderators Posted February 19, 2010 Final version,2 solutions for you:1. Use $SC_DRAGMOVE on the whole GUI:#include <GuiconstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", "On_Exit") Func On_Exit() Exit EndFunc $hGUI = GUICreate("X", 50, 50, -1, -1, BitOR($WS_POPUP,$WS_BORDER), $WS_EX_TOPMOST) GUISetBkColor(0xFF0000, $hGUI) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd2: Use $GUI_WS_EX_PARENTDRAG on a label:#include <GuiconstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "On_Exit") Func On_Exit() Exit EndFunc $hGUI = GUICreate("X", 50, 50, -1, -1, BitOR($WS_POPUP,$WS_BORDER), $WS_EX_TOPMOST) $hLabel = GUICtrlCreateLabel("", 0, 0, 50, 50, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState() While 1 Sleep(10) WEndPersonally I prefer the former. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
FinalVersion Posted February 19, 2010 Author Posted February 19, 2010 I seen the first example in another post of yours. But it doesn't check to see if the mouse is in the top 20px, and I'd rather not have to make a label to move the GUI, but thanks. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
JRowe Posted February 19, 2010 Posted February 19, 2010 Your example, combined with his example, makes what you need. It's also better than tracking mousePos and using winMove yourself. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
FinalVersion Posted February 19, 2010 Author Posted February 19, 2010 The label example or the $SC_DRAGMOVE? [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center]
JRowe Posted February 19, 2010 Posted February 19, 2010 $SC_DRAGMOVE. Sometihng like this: $mPos = MouseGetPos() If $mPos[1] < 20 Then _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndIf [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
ProgAndy Posted February 19, 2010 Posted February 19, 2010 using WM_NCHITTEST you can specify the parts as you want#include <GuiconstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", "On_Exit") Func On_Exit() Exit EndFunc $hGUI = GUICreate("X", 300, 100, -1, -1, BitOR($WS_POPUP,$WS_BORDER), $WS_EX_TOPMOST) GUISetBkColor(0xFF0000, $hGUI) GUIRegisterMsg($WM_NCHITTEST, "_MY_NCHITTEST") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit EndSwitch WEnd Func _MY_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) ; Author: Prog@ndy Switch $hWnd Case $hGUI Local $aPos = WinGetPos($hWnd) ; BitAnd(BitShift($lParam, 16),0xFFFF) will return HIWORD If Abs(BitAND(BitShift($lParam, 16),0xFFFF)- $aPos[1]) < 20 Then Return $HTCAPTION ; the first 20 px from top will be TitleBar EndSwitch Return $GUI_RUNDEFMSG EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Moderators Melba23 Posted February 19, 2010 Moderators Posted February 19, 2010 ProgAndy, Nice one. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now