Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Drag and Drop


  • Please log in to reply
6 replies to this topic

#1 Kip

Kip

    Into the JavaScript

  • Active Members
  • PipPipPipPipPipPip
  • 1,690 posts

Posted 19 May 2007 - 06:45 PM

Can I get some more information about handling drag and drop? I can't find so much information about it in the help file.

thnx, Kip







#2 Gif

Gif

    Laikon Kafekoption

  • Active Members
  • PipPipPipPipPipPip
  • 1,117 posts

Posted 19 May 2007 - 07:09 PM

Can I get some more information about handling drag and drop? I can't find so much information about it in the help file.

thnx, Kip



what exacly do you want to know? whatever it is search in autoit library and here

#3 Kip

Kip

    Into the JavaScript

  • Active Members
  • PipPipPipPipPipPip
  • 1,690 posts

Posted 21 May 2007 - 03:39 PM

no, that's only Perform Drag/drop. But I wanna know: If you drag and drop in a GUI, where does the drag start (x,y) and where does it end? (x,y)

#4 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 21 May 2007 - 04:01 PM

no, that's only Perform Drag/drop. But I wanna know: If you drag and drop in a GUI, where does the drag start (x,y) and where does it end? (x,y)


You want to CAUSE a drag-n-drop, or MONITOR one?

If you want to do it from the script, look at MouseClickDrag() in the help file.

If you want to monitor the user doing it, I think you want _IsPressed() to monitor the button down and button up, getting the mouse coordinates with MouseGetPos() at each end. This would raise the question of how to tell the difference between a click-n-drag and just a click... I don't know.

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#5 James

James

    Universalist

  • MVPs
  • 10,365 posts

Posted 21 May 2007 - 06:32 PM

He wants to monitor one, so he can find out where the GUI is placed so it can be added to the users script created in his program.

#6 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 21 May 2007 - 07:13 PM

In that case, this will assume that holding down left click more than 500msec is a "click-n-drag", and will ToolTip the X/Y coordinates at each end:
AutoIt         
#include <misc.au3> While 1     If _IsPressed("01") Then         $MousePos = MouseGetPos()         $Timer = TimerInit()         Do             If Not _IsPressed("01") Then ExitLoop         Until TimerDiff($Timer) > 500         If _IsPressed("01") Then             ToolTip("Left click held down at:" & @LF & _                     "X = " & $MousePos[0] & "   Y = " & $MousePos[1])             Do                 Sleep(5)             Until Not _IsPressed("01")             $MousePos = MouseGetPos()             ToolTip("Left click released at:" & @LF & _                     "X = " & $MousePos[0] & "   Y = " & $MousePos[1] & @LF & _                     "In " & Round(TimerDiff($Timer) / 1000, 3) & " seconds.")             ExitLoop         EndIf     EndIf WEnd MsgBox(64, "Success", "Detected left click held more than 500msec.")

There may be some slick Windows API to tell if an actual object (text, file name, etc.) is being dragged, but that would require an answer from smarter people than me.

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#7 Kip

Kip

    Into the JavaScript

  • Active Members
  • PipPipPipPipPipPip
  • 1,690 posts

Posted 21 May 2007 - 08:27 PM

thnx for that script. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users