Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference »

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

drag

drag from point to point
drag from point to point with key1
drag from point to point ¬
with key1, key2
drag from point to point ¬
with key1, key2, key3

The drag command simulates the user dragging the mouse manually (except that you must use the with shiftKey option in order to select text in a field).

The with key options specify combinations of the commandKey, the optionKey, and the shiftKey, simulating the user holding down the key or keys while dragging.

Examples

drag from 0,0 to 100,100
drag from 0,0 to 100,100 with shiftKey
drag from 0,0 to 100,100 with shiftKey,cmdKey,optionKey
drag from the mouseLoc to the bottomRight of this card

Demo Script

on mouseUp
set the cantModify of this stack to true
show bkgnd field "Demo Field"
show card picture
dragChart "13,184,98,268",70 -- Pile One
dragChart "100,184,185,268",133 -- Pile Two
dragChart "185,184,270,268",93 -- Pile Three
dragChart "270,184,355,268",140 -- Pile Four
dragChart "355,184,440,268",175 -- Pile Five
choose browse tool
wait 50
hide card picture
hide bkgnd field "Demo Field"
set cantModify of this stack to false
end mouseUp
on dragChart theRect, theHeight
put item 1 of theRect into theLeft
put item 2 of theRect into theTop
put item 3 of theRect into theRight
put item 4 of theRect into theBottom
choose select tool
set the dragSpeed to 0
drag from theLeft,theTop to theRight,theBottom with optionKey
put round((theRight - theLeft)/2 + theLeft) into locH
put round((theBottom - theTop)/2 + theTop) into locV
doMenu "opaque"
set the dragSpeed to 200
drag from locH,locV to locH,(locV - theHeight) ¬
with optionKey,commandKey
end dragChart

Related Topics

Placeholders

point

HyperTalk Definition

An expression that evaluates to a specific screen location, in the form of two integers separated by a comma.

Item 1 of a point is the horizontal offset (in pixels). Item 2 of a point is the vertical offset (in pixels). For example:

91,303
"91,303"
"30" & "," & "100"
the clickLoc

AppleScript Definition

An expression that evaluates to a specific screen location, in the form of a list with two integer elements. For example:

{ 91, 303 }
clickLoc

key

In HyperTalk, one of the following:

cmdKey
commandKey
optionKey
shiftKey

In AppleScript, one of the following:

command key
option key
shift key

HyperTalk Reference


Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Modern View