AustrianOak Posted July 1, 2008 Share Posted July 1, 2008 (edited) How do i make a draggable input control. where i can click anywhere on it to drag it? would it be best to put a transparent label over it? Edited August 10, 2008 by IWantIt Link to comment Share on other sites More sharing options...
martin Posted July 1, 2008 Share Posted July 1, 2008 How do i make a draggable input control. where i can click anywhere on it to drag it? would it be best to put a transparent label over it?Like this perhaps #include <GuiConstants.au3> #include <misc.au3> $gui = GUICreate("drag input") $ip = GUICtrlCreateInput("drag me", 20, 20, 120, 22) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $nc = GUIGetCursorInfo() If $nc[4] = $ip Then $mp = MouseGetPos() $cp = ControlGetPos("drag input", "", $ip) While _IsPressed(1) $nm = MouseGetPos() ControlMove("drag input", "", $ip, $cp[0] - $mp[0] + $nm[0], $cp[1] - $mp[1] + $nm[1]) WEnd EndIf EndSwitch WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ProgAndy Posted July 1, 2008 Share Posted July 1, 2008 This way, you can't move it out of the window: expandcollapse popup#include <GuiConstants.au3> #include <misc.au3> $gui = GUICreate("drag input") $ip = GUICtrlCreateInput("drag me", 20, 20, 120, 22) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $nc = GUIGetCursorInfo() If $nc[4] = $ip Then $mp = MouseGetPos() $cp = ControlGetPos("drag input", "", $ip) $max = WinGetClientSize($gui) While _IsPressed(1) $nm = MouseGetPos() $x = $cp[0] - $mp[0] + $nm[0] $y = $cp[1] - $mp[1] + $nm[1] Select Case $y < 0 $y = 0 Case $y > $max[1]-$cp[3] $y = $max[1]-$cp[3] EndSelect Select Case $x < 0 $x = 0 Case $x > $max[0]-$cp[2] $x = $max[0]-$cp[2] EndSelect ControlMove("drag input", "", $ip, $x,$y) Sleep(10) WEnd EndIf EndSwitch WEnd *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 Link to comment Share on other sites More sharing options...
martin Posted July 1, 2008 Share Posted July 1, 2008 This way, you can't move it out of the window: expandcollapse popup#include <GuiConstants.au3> #include <misc.au3> $gui = GUICreate("drag input") $ip = GUICtrlCreateInput("drag me", 20, 20, 120, 22) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $nc = GUIGetCursorInfo() If $nc[4] = $ip Then $mp = MouseGetPos() $cp = ControlGetPos("drag input", "", $ip) $max = WinGetClientSize($gui) While _IsPressed(1) $nm = MouseGetPos() $x = $cp[0] - $mp[0] + $nm[0] $y = $cp[1] - $mp[1] + $nm[1] Select Case $y < 0 $y = 0 Case $y > $max[1]-$cp[3] $y = $max[1]-$cp[3] EndSelect Select Case $x < 0 $x = 0 Case $x > $max[0]-$cp[2] $x = $max[0]-$cp[2] EndSelect ControlMove("drag input", "", $ip, $x,$y) Sleep(10) WEnd EndIf EndSwitch WEndYes, that's better. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 2, 2008 Author Share Posted July 2, 2008 Thank you both of you for the examples. Is there someway I can drag it "out" of the window wherever I want and place it on my desktop? Link to comment Share on other sites More sharing options...
TehWhale Posted July 2, 2008 Share Posted July 2, 2008 Thank you both of you for the examples.Is there someway I can drag it "out" of the window wherever I want and place it on my desktop?That would require some work. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 2, 2008 Author Share Posted July 2, 2008 Really? I'm not asking someone to do it for me, I'm asking for some guidance...a starting point, advice.. Link to comment Share on other sites More sharing options...
TehWhale Posted July 2, 2008 Share Posted July 2, 2008 Really? I'm not asking someone to do it for me, I'm asking for some guidance...a starting point, advice..Yes I know that, but I'm not even sure how to do it. You might have to make a transparent gui, and then the original gui, and then drag it that way. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 2, 2008 Author Share Posted July 2, 2008 I'll take that into consideration. Right now I'm having some trouble with some logic and I need help. Look at the code below: #include <guiconstants.au3> #include <misc.au3> $gui = GUICreate("", 300, 300) GUICtrlCreateInput("", 20, 20, 120, 22) $button = GUICtrlCreateButton("", 200, 20, 40, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $button $movinginput = GUICtrlCreateInput("", 40, 280, 100, 30) Case $GUI_EVENT_PRIMARYDOWN $CursorInfo = GUIGetCursorInfo() If $CursorInfo[4] = $movinginput Then $mousepos = MouseGetPos() $cp = ControlGetPos($Gui, "", $movinginput) While _IsPressed(1) $nm = MouseGetPos() ControlMove($Gui, "", $movinginput, $cp[0] - $mousepos[0] + $nm[0], $cp[1] - $mousepos[1] + $nm[1]) WEnd EndIf EndSelect WEnd What if on a button press I want to create the draggable input to drag. It would give me an error on the last Case statement saying $movinginput is undeclared. How can I solve this? I want to type whatever into the first input and it will make another input to drag around. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 2, 2008 Author Share Posted July 2, 2008 Is there another way I should place the data? Link to comment Share on other sites More sharing options...
martin Posted July 2, 2008 Share Posted July 2, 2008 Is there another way I should place the data?Here is an example of a way to move the input anywhere. It needs more logic to make the input move with the main window if that's needed, which I would do with GuiRegisterMsg($WM_MOVE,"My_WM_MOVE") #include <guiconstants.au3> #include <misc.au3> #include <windowsconstants.au3> $gui = GUICreate("", 300, 300, 400, 400) $button = GUICtrlCreateButton("", 200, 20, 40, 40) GUISetState() $Gc = GUICreate("move anywhere", 120, 22, 420, 460, $WS_POPUP) $movinginput = GUICtrlCreateInput("", 0, 0, 120, 22) GUISetState() WinSetOnTop($Gc, "", 1) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $GUI_EVENT_PRIMARYDOWN $CursorInfo = GUIGetCursorInfo() If IsArray($CursorInfo) Then If $CursorInfo[4] = $movinginput Then $mousepos = MouseGetPos() $cp = WinGetPos($Gc);ControlGetPos($Gui, "", $movinginput) While _IsPressed(1) $nm = MouseGetPos() WinMove($Gc, "", $cp[0] - $mousepos[0] + $nm[0], $cp[1] - $mousepos[1] + $nm[1]) WEnd EndIf EndIf EndSelect WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 2, 2008 Author Share Posted July 2, 2008 Thank you martin! As far as my previous question I no longer need an answer. Your example has given me and explained to me everything I need. Much thanks. Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 2, 2008 Share Posted July 2, 2008 Very nice solution martin! Here is the same without using _IsPressed()... #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Move Input Anywhere Example", 300, 300) GUISetState() $hInput_GUI = GUICreate("", 120, 22, 380, 260, $WS_POPUP) $Input = GUICtrlCreateInput("Move me :)", 0, 0, 120, 22) GUISetState() WinSetOnTop($hInput_GUI, "", 1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $aCursorInfo = GUIGetCursorInfo() $aMouse_Pos = MouseGetPos() $aInputGUI_Pos = WinGetPos($hInput_GUI) If Not IsArray($aCursorInfo) Or $aCursorInfo[4] <> $Input Then ContinueLoop While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI, "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndSwitch WEnd Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted July 2, 2008 Share Posted July 2, 2008 Very nice solution martin! Here is the same without using _IsPressed()... #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Move Input Anywhere Example", 300, 300) GUISetState() $hInput_GUI = GUICreate("", 120, 22, 380, 260, $WS_POPUP) $Input = GUICtrlCreateInput("Move me :)", 0, 0, 120, 22) GUISetState() WinSetOnTop($hInput_GUI, "", 1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN $aCursorInfo = GUIGetCursorInfo() $aMouse_Pos = MouseGetPos() $aInputGUI_Pos = WinGetPos($hInput_GUI) If Not IsArray($aCursorInfo) Or $aCursorInfo[4] <> $Input Then ContinueLoop While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI, "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndSwitch WEndYes MrCreatoR, you're right. Better to use the information that is already in the array rather than another function and another include. Thanks. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 5, 2008 Author Share Posted July 5, 2008 @martin: I understand your logic and how you got the input to be draggable outside the window but I have been working on creating the draggable input from pressing a button for a while and have had no success. Can someone help me with the logic? Link to comment Share on other sites More sharing options...
AustrianOak Posted July 5, 2008 Author Share Posted July 5, 2008 Is it possible to create this draggable input from pressing a button first? Should I Dim the variables that aren't yet created. I need some help... Link to comment Share on other sites More sharing options...
martin Posted July 5, 2008 Share Posted July 5, 2008 @martin: I understand your logic and how you got the input to be draggable outside the window but I have been working on creating the draggable input from pressing a button for a while and have had no success. Can someone help me with the logic? expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Move Input Anywhere Example", 300, 300) $btn = GUICtrlCreateButton("make draggable input", 10, 10, 150, 22) Dim $hInput_GUI[10], $Input[10];need extra logic if more than 10 created GUISetState() Global $lastdragIP = -1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btn If $lastdragIP < 9 Then $lastdragIP += 1 createNextdragIP($lastdragIP) EndIf Case $GUI_EVENT_PRIMARYDOWN $aMouse_Pos = MouseGetPos() $sel = -1 For $n = 0 To $lastdragIP GUISwitch($hInput_GUI[$n]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop If $aCursorInfo[4] = $Input[$n] Then $sel = $n ExitLoop EndIf Next If $sel = -1 Then ContinueLoop $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$sel], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndSwitch WEnd Func createNextdragIP($nw) $start = WinGetPos($hGUI) $hInput_GUI[$nw] = GUICreate("", 120, 22, $start[0] + 50, $start[1] + 60 + 25 * $nw, $WS_POPUP) $Input[$nw] = GUICtrlCreateInput("Move No. " & $nw + 1, 0, 0, 120, 22) GUICtrlSetBkColor(-1,0xffff00) GUISetState() WinSetOnTop($hInput_GUI, "", 1) EndFunc ;==>createNextdragIP You could make a nice PostIt script with this, or maybe that's what you are doing. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
AustrianOak Posted July 6, 2008 Author Share Posted July 6, 2008 (edited) You could make a nice PostIt script with this, or maybe that's what you are doing. muttley Edited July 7, 2008 by nowagain Link to comment Share on other sites More sharing options...
AustrianOak Posted July 16, 2008 Author Share Posted July 16, 2008 @martin: I am having trouble deleting an item using the code below, as you will see, when i will right click on the icon and click delete on the context menu, nothing happens.. Can you help me solve this because I've been working on this for a long time with no success.... muttley expandcollapse popup#Include <GUIConstantsEx.au3> #Include <WindowsConstants.au3> Dim $hInput_GUI[50], $Input[50] $Gui = GUICreate("", 300, 300) $btn = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 32, 58, 26, 26) GUISetState() Global $lastdragIP = -1 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close Exit Case $msg = $btn If $lastdragIP < 49 Then $lastdragIP += 1 createNextdragIP($lastdragIP) EndIf Case $GUI_EVENT_PRIMARYDOWN $aMouse_Pos = MouseGetPos() $sel = -1 For $n = 0 To $lastdragIP GUISwitch($hInput_GUI[$n]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop If $aCursorInfo[4] = $Input[$n] Then $sel = $n ExitLoop EndIf Next If $sel = -1 Then ContinueLoop $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$sel], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd Case $msg = $item_delete GUICtrlDelete($Input[$nw]) EndSelect WEnd Func createNextdragIP($nw) $start = WinGetPos($GUI) $hInput_GUI[$nw] = GUICreate("", 26, 26, $start[0] + 65, $start[1] + 60 + 25, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED)) $Input[$nw] = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 0, 0, 26, 26, -1) GUICtrlSetBkColor(-1,0xffff00) $context_menu = GUICtrlCreateContextMenu($Input[$nw]) $item_delete = GUICtrlCreateMenuItem("Delete...", $context_menu) GUISetState() WinSetOnTop($hInput_GUI, "", 1) EndFunc ;==>createNextdragIP Link to comment Share on other sites More sharing options...
martin Posted July 16, 2008 Share Posted July 16, 2008 @martin: I am having trouble deleting an item using the code below, as you will see, when i will right click on the icon and click delete on the context menu, nothing happens.. Can you help me solve this because I've been working on this for a long time with no success.... muttley expandcollapse popup#Include <GUIConstantsEx.au3> #Include <WindowsConstants.au3> Dim $hInput_GUI[50], $Input[50] $Gui = GUICreate("", 300, 300) $btn = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 32, 58, 26, 26) GUISetState() Global $lastdragIP = -1 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close Exit Case $msg = $btn If $lastdragIP < 49 Then $lastdragIP += 1 createNextdragIP($lastdragIP) EndIf Case $GUI_EVENT_PRIMARYDOWN $aMouse_Pos = MouseGetPos() $sel = -1 For $n = 0 To $lastdragIP GUISwitch($hInput_GUI[$n]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop If $aCursorInfo[4] = $Input[$n] Then $sel = $n ExitLoop EndIf Next If $sel = -1 Then ContinueLoop $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$sel], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd Case $msg = $item_delete GUICtrlDelete($Input[$nw]) EndSelect WEnd Func createNextdragIP($nw) $start = WinGetPos($GUI) $hInput_GUI[$nw] = GUICreate("", 26, 26, $start[0] + 65, $start[1] + 60 + 25, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED)) $Input[$nw] = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 0, 0, 26, 26, -1) GUICtrlSetBkColor(-1,0xffff00) $context_menu = GUICtrlCreateContextMenu($Input[$nw]) $item_delete = GUICtrlCreateMenuItem("Delete...", $context_menu) GUISetState() WinSetOnTop($hInput_GUI, "", 1) EndFunc;==>createNextdragIP Something like this might do it. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $hInput_GUI[50], $Input[50], $context_menu[50], $item_delete[50] $Gui = GUICreate("", 300, 300) $btn = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 32, 58, 26, 26) GUISetState() Global $lastdragIP = -1 While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_Event_Close Exit Case $msg[0] = $btn If $lastdragIP < 49 Then $lastdragIP += 1 createNextdragIP($lastdragIP) EndIf Case $msg[0] = $GUI_EVENT_PRIMARYDOWN $aMouse_Pos = MouseGetPos() $sel = -1 For $n = 0 To $lastdragIP GUISwitch($hInput_GUI[$n]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop If $aCursorInfo[4] = $Input[$n] Then $sel = $n ExitLoop EndIf Next If $sel = -1 Then ContinueLoop $aInputGUI_Pos = WinGetPos($hInput_GUI[$sel]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$sel], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndSelect If $lastdragIP >= 0 Then Select Case $msg[0] >= $item_delete[0] And $msg[0] <= $item_delete[$lastdragIP] For $n = 0 To $lastdragIP If $msg[0] = $item_delete[$n] Then GUICtrlDelete($Input[$n]) EndIf Next EndSelect EndIf WEnd Func createNextdragIP($nw) $start = WinGetPos($Gui) $hInput_GUI[$nw] = GUICreate("", 26, 26, $start[0] + 65, $start[1] + 60 + 25, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED)) $Input[$nw] = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 0, 0, 26, 26, -1) GUICtrlSetBkColor(-1, 0xffff00) $context_menu[$nw] = GUICtrlCreateContextMenu($Input[$nw]) $item_delete[$nw] = GUICtrlCreateMenuItem("Delete...", $context_menu[$nw]) ConsoleWrite("nw = " & $nw & @CRLF) GUISetState() WinSetOnTop($hInput_GUI, "", 1) EndFunc ;==>createNextdragIP Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
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