drag and drop
drag and drop
- Subject: drag and drop
- From: Volker Bublitz <email@hidden>
- Date: Mon, 7 Oct 2002 21:31:31 +0200
hello to all :-)
i've made an interface with interface builder and connected a subclass
of NSTextField(myTextField) with a subclass of NSObject, which has an
Action called myAction. i created the .h and .m files in my
project-builder project and added the following code to the myTextField
class:
- (void)awakeFromNib
{
[self registerForDraggedTypes:[NSArray arrayWithObjects:
NSFilenamesPboardType, nil]];
}
- (IBAction)draggingEntered:(id)sender
{
}
- (IBAction)draggingUpdated:(id)sender
{
}
- (BOOL)performDragOperation:(id)sender
{
NSPasteboard *pboard;
pboard = [sender draggingPasteboard];
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
[self setObjectValue:files];
return YES;
}
i wanted the myTextField object in my UI to display the path of the
files which are dragged into the textfield. this works fine as long as
i drag a file or folder just to the outside edge of myTextField. just
in the moment i move the mouse over the middle of the myTextField it
doesn't work anymore...
i want to add that i'm with cocoa just for 2 days now and am excited
how easy most of this GUI stuff is. it's really cool. perhaps you all
can bring me on the right way to solve my problems with cocoa-apps ;-)
greets,
volker
_______________________________________________
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.