How to notify user as to acceptable drop targets?

Ned Konz ned at bike-nomad.com
Mon Apr 15 19:52:37 UTC 2002


On Monday 15 April 2002 12:18 pm, Martin McClure wrote:
> To make this work, the d'n'd framework has to send a message to
> each potential target as you pass over it to see if it would accept
> the dragged object. If this slows things down too much, you could
> wait until the user has paused over a potential target for a few
> hundred milliseconds before sending the message.

How do you feel about cursor highlighting? That's easy to do.

> Morph>>wantsDroppedMorph:event: might be able to be used for this,
> but I haven't looked to see when it's sent.

The problem with wantsDroppedMorph:event: is that it has other 
meanings in Morphic (usually relating to d'n'd or submorph adding).

I've added a query to Morph

wantsAttachmentFromEnd: endIndex ofConnector: aConnector at: aPoint

that is just for use by Connectors. This is used inside 
#connectionTargetsAt:for: to determine what a dropped Connector end 
will connect to.

So I added this to NCConnectorMorph:

monitorDestinationForEnd: aConstraint
	| targets |
	targets _ self connectionTargetsAt: aConstraint center for: 
aConstraint.
	ActiveHand showTemporaryCursor: (targets isEmpty
		ifTrue: [ Cursor crossHair ]
		ifFalse: [ Cursor webLink ])

And at the right times I do this:

	self startStepping: #monitorDestinationForEnd:
		at: Time millisecondClockValue
		arguments: { constraint }
		stepTime: 200

And it changes the cursor. Of course, it could highlight the targets 
instead/in addition.

The D'n'd support highlights the targets in a blue outline.
-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list