Using Xcode 2.1, is there any way to specify a drop/drag modifier? I searched here and couldn’t find it. For example: Someone hold’s option down while dragging it to the image well, it bypasses confirmation?
sorry for so many questions, I’ve never worked with drag and drop much before
I don’t think the drag info record contains any modifier or keyboard information. However, you can attach a “mouse entered” handler to your image view. The mouse entered event does contain the modifier information you want and you can get it like so:
property command_key_down: false
property control_key_down: false
property option_key_down: false
property shift_key_down: false
on mouse entered the_object event the_event
tell the_event to set {command_key_down, control_key_down, option_key_down, shift_key_down} to {command key down, control key down, option key down, shift key down}
end mouse entered
Did you write the book on AppleScript? Because if you didn’t, you should’ve.
This:
[code]property option_key_down : false
on mouse entered theObject event theEvent
tell theEvent to set {option_key_down} to {option key down}
if the name of theObject = “theWell” and option_key_down then
set option_key_down to true
end if
end mouse entered
on drop theObject drag info dragInfo
if option_key_down then
display dialog “1”
set option_key_down to false
else
display dialog “2”
set option_key_down to false
end if
end drop[/code]
Seems to work fine, so I’m going to try it out in my actual application. I just may have to post it here when I’m done.
property option_key_down : false
on mouse entered theObject event theEvent
tell theEvent to set option_key_down to option key down
end mouse entered
on drop theObject drag info dragInfo
if option_key_down then
display dialog "1"
else
display dialog "2"
end if
set option_key_down to false
end drop