Re: Dragging to text fields
Re: Dragging to text fields
- Subject: Re: Dragging to text fields
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 15 Mar 2002 14:57:12 -0500
on 02-03-15 1:11 PM, Bill Cheeseman at email@hidden wrote:
>
Is there a standard or recommended way to implement dragging to text fields
>
in Cocoa?
Well, here's a great surprise. It turns out that I can make it all work
exactly right just by having the draggingUpdated: protocol method make the
textfield over which the mouse is hovering the window's first responder.
That way I get entirely correct HI behavior automatically, apparently
because the field editor's built-in drag and drop support kicks in. When
the destination window is frontmost, each text field gets its focus ring as
I drag some text over it, and the text currently in the field is highlighted
(as the Aqua HI Guidelines require), and the insertion point moves within
the current text as I move the mouse around inside the text field. When I
drop the text, it lands in the right place, and it even triggers a connected
formatter if the dropped text is illegal. And all this also happens if the
window is in the background, except the blue focus ring doesn't show. (The
only hangup so far is that a formatter for the last field I dropped
something on is triggered when a second field becomes first responder.)
This seems so easy and so right that I can't believe it isn't documented
anywhere. Is this just a happy coincidence? Is something else going to jump
up and bite me?
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.