objective c - Strange NSPasteboard and TextEdit interaction -
i drag-dropping string 2 places in app. 1 custom nsview
, 1 nstabledatasource
delegate. first 1 allows me drag text textedit application, second 1 not. can drag both other apps such terminal or textmate. far can tell, i'm using close identical code both.
i'm trying figure out what's wrong. it's working in principle because can drag apps. what's going on textedit?
from custom nsview:
(void)mousedown:(nsevent *)theevent { nsstring *teststring = @"test"; nsimage *dragimage; nspoint dragposition; nspasteboard *pboard = [nspasteboard pasteboardwithname:nsdragpboard]; [pboard declaretypes:[nsarray arraywithobjects: nsstringpboardtype, nil] owner:nil]; [pboard setstring:teststring fortype:nsstringpboardtype]; dragimage = // blah dragposition = [self convertpoint:[theevent locationinwindow] fromview:nil]; [self dragimage:dragimage at:dragposition offset:nszerosize event:theevent pasteboard:pboard source:self slideback:yes]; } }
from table delegate:
(bool)tableview: (nstableview *)atableview writerowswithindexes: (nsindexset *)indexes topasteboard: (nspasteboard *)pboard { nsstring *teststring = @"test"; [pboard declaretypes:[nsarray arraywithobjects: nsstringpboardtype, nil] owner:nil]; [pboard setstring:teststring fortype:nsstringpboardtype]; return yes; }
if print out pboard's types first one:
"public.utf8-plain-text", nsstringpboardtype,
and second:
"public.utf8-plain-text", nsstringpboardtype,
likewise, content first:
2010-11-16 13:56:01.832 xxx[1654:a0f] public.utf8-plain-text:test 2010-11-16 13:56:01.838 xxx[1654:a0f] nsstringpboardtype:test
and second
2010-11-16 13:56:05.623 xxx[1654:a0f] public.utf8-plain-text:test 2010-11-16 13:56:05.623 xxx[1654:a0f] nsstringpboardtype:test
so far can tell, 2 should behaving identically. they're not. ideas?
Comments
Post a Comment