Re: Text Views, Text Fields and dragging
Re: Text Views, Text Fields and dragging
- Subject: Re: Text Views, Text Fields and dragging
- From: Matt Neuburg <email@hidden>
- Date: Tue, 14 Sep 2004 11:53:59 -0700
On Sun, 12 Sep 2004 13:32:23 -0700 (PDT), Harilaos Skiadas
<email@hidden> said:
>I'll give it another try and send my question again,
>in hope for some response. It seems like a simple
>question, but I can't figure out what goes wrong.
>The situation is as follows. I have two windows,
>window 1 and window 2. Window 1 has a text view, and
>so does Window 2. They have not been subclassed.
>Window 1 is the document window for a document based
>application. Window 2 is in the same application,
>different NIB file. Window 2 also has a text field. I
>have subclassed the text field and added the six
>operations supposed to allow drag and drop (code
>follows) and have implemented my own way to deal with
>the dropped data. When I drag to the text field from
>the text view of window 2 (i.e. same window), no
>problem, my code works fine.
>But when I drag and drop from the text view in window
>1 to the text field, it doesn't. To be more precise,
>draggingEntered: and draggingExited: get called from
>the text field, which I see with an NSLog, but neither
>prepareForDragOperation: nor performDragOperation: get
>called.
Like everything else with NSTextFields, drag and drop is tricky because if
the NSTextField contains the insertion point (has the focus) in its window,
it has a field editor, and now the field editor is in your way. My guess is
that that's what's happening to you. The interplay between the field editor
and the NSTextField during a drop is extraordinarily difficult to figure
out. So my solution has always been just to give up - in the NSTextField's
draggingEntered: I call [[self window] makeFirstResponder: nil] so there is
no field editor. This might not be the same as the problem you're having,
but it seems worth a go. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden