Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sirjorj

macrumors newbie
Original poster
Oct 26, 2007
28
4
Hi. I am fairly new to Cocoa programming and I have a problem that I have not been able to figure out. I have a simple little Cocoa app consisting of a TableView and a multiline TextField and I want to be able to drop a file anywhere on the app. I have made an app that would accept drop on a textfield, but now I want to be able to drop it anywhere on the window.

First I tried selecting the main view in Interface Builder and changing the class to DroppableView (a class I made subclassed from NSView to implement the drag/drop handlers) but initWithFrame would never fire when I run the program.

Then I returned the class to NSView and covered it with a CustomView control and set its class to DroppableView. This would fire the initWithFrame controls, but the TableView and TextField that I had on top of the control were no longer visible.

This shouldn't be that complicated of a thing to do, but I am out of ideas. Any help?

jorj
 

sirjorj

macrumors newbie
Original poster
Oct 26, 2007
28
4
Thanks a ton! I have been looking for that for a while!

UPDATE: Now the view catches the events but the TableView and TextField I have on it are not visible at runtime. Do I have to programmatically add them since I overrode the view?

ANOTHER UPDATE: never mind - I wasn't calling super's init - now it works

jorj
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.