Jump to content
Sign in to follow this  
SandelPerieanu

GUICtrlSetOnMove.au3

Recommended Posts

SandelPerieanu

hi,

any improvement is welcomed

GuiCtrlSetonmove.au3

#include-once
#include <GUIConstantsEx.au3>
Global $move_id_control = 0, $last_primary_down_mctrlgui = 0, $dif_x_mctrlgui = 0, $dif_y_mctrlgui = 0
Global $mctrlgui_ctrls = '|'
;
Func GuiCtrlSetonmove($mctrlgui_ctrls_gui, $mctrlgui_ctrls_id, $mctrlgui_enable = True)
   If $mctrlgui_enable Then
      $mctrlgui_ctrls &= $mctrlgui_ctrls_gui & '*' & $mctrlgui_ctrls_id & '|'
   Else
      $mctrlgui_ctrls = StringReplace($mctrlgui_ctrls, '|' & $mctrlgui_ctrls_gui & '*' & $mctrlgui_ctrls_id & '|', '|')
   EndIf
   GUISetOnEvent($gui_event_mousemove, "WM_MOVE_CONTROLS")
EndFunc   ;==>GuiCtrlSetonmove
;
Func WM_MOVE_CONTROLS()
   Local $mctrlgui = @GUI_WinHandle
   If Not IsHWnd($mctrlgui) Then Return
   Local $cursorinfo_mctrlgui, $control_pos_mctrlgui
   $cursorinfo_mctrlgui = GUIGetCursorInfo($mctrlgui)
   $control_pos_mctrlgui = ControlGetPos('', '', $move_id_control)
   If $move_id_control <> $cursorinfo_mctrlgui[4] And $last_primary_down_mctrlgui = 0 Then $move_id_control = $cursorinfo_mctrlgui[4]
   If StringReplace($mctrlgui_ctrls, '|' & @GUI_WinHandle & '*' & $move_id_control & '|', '') <> $mctrlgui_ctrls Then
      If $last_primary_down_mctrlgui <> $cursorinfo_mctrlgui[3] Then
         $last_primary_down_mctrlgui = $cursorinfo_mctrlgui[3]
         $move_id_control = $cursorinfo_mctrlgui[4]
         If $last_primary_down_mctrlgui = 1 Then
            ControlDisable(@GUI_WinHandle, '', $move_id_control)
            $dif_x_mctrlgui = $cursorinfo_mctrlgui[0] - $control_pos_mctrlgui[0]
            $dif_y_mctrlgui = $cursorinfo_mctrlgui[1] - $control_pos_mctrlgui[1]
         Else
            ControlEnable(@GUI_WinHandle, '', $move_id_control)
            $dif_x_mctrlgui = 0
            $dif_x_mctrlgui = 0
         EndIf
      EndIf
      If $cursorinfo_mctrlgui[3] = 1 And $move_id_control > 0 Then
         ControlMove('', '', $move_id_control, $cursorinfo_mctrlgui[0] - $dif_x_mctrlgui, $cursorinfo_mctrlgui[1] - $dif_y_mctrlgui)
      EndIf
   EndIf
EndFunc   ;==>WM_MOVE_CONTROLSoÝ÷ Ù±®+k'­:s(½àÞ®ßöÚºÚ"µÍÚ[ÛYH    ÑÕRPÛÛÝ[Ñ^]LÉÝÂÚ[ÛYH ÑÝZPÝÙ]Û[ÝK]LÉÝÂÜ
    ][ÝÑÕRSÛ][[ÙI][ÝËJBÌÍÛXZ[ÙÝZWÌHHÕRPÜX]J  ÌÎNÓ[ÝHHYIÌÎNË
L
LLKLJBÕRTÙ]Û][
    ÌÍÙÝZWÙ][ØÛÜÙK ÌÎNÑ^]Ð[    ÌÎNÊBÌÍØÝÌHHÕRPÝÜX]P]Û  ÌÎNÕÝÌIÌÎNË
K
KLL
BÕRPÝÙ]Û][
    ÌÍØÝÌK ÌÎNÕÝ   ÌÎNÊBÝZPÝÙ]Û[ÝJ ÌÍÛXZ[ÙÝZWÌK  ÌÍØÝÌJBÌÍØÝÌHÕRPÝÜX]QY]
    ÌÎNÕÝÌÌÎNËMLLLL
BÝZPÝÙ]Û[ÝJ    ÌÍÛXZ[ÙÝZWÌK  ÌÍØÝÌBÕRTÙ]Ý]J
BÂÛÛ
    ][ÝÕÚ][ÝÙWÔÙXÛÛWÐ]Û[ÝHØ[[ÝHHÛÛÛÈ
YÉÌÎNÛÌÎNÑÜ
I][ÝÊBÂÚ[HBÛY
JBÑ[Â[È^]Ð[

B^][[ÈÏOIÝÑ^]Ð[Â[ÈÝ

BÙÐÞ
M
    ÌÎNÉÌÎNËÕRPÝXY
    ÌÍØÝÌJBÝZPÝÙ]Û[ÝJ ÌÍÛXZ[ÙÝZWÌK  ÌÍØÝÌK[ÙJBÛÛ
    ÌÎNÓÝÈÛH  ÌÍØÝÌØ[H[ÝIÌÎNÊB[[ÈÏOIÝÕÝ
Edited by psandu.ro

Share this post


Link to post
Share on other sites
SandelPerieanu

nobody?

Share this post


Link to post
Share on other sites
damian666

wtf... thats cool man ^^

can ya make it so that it remembers teh place ya put the controls?

nice script man, very clear written ^^

Damian666


and proud of it!!!

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  

×