Drag and drop issues

I’m trying to create a simple app with two tabs, each tab allowing a file to be dragged and dropped onto it. I’ve created a large box in each tab and given the boxes a “drop” handler. I’ve then added a “register drag types {“file names”}” to “awake from nib.” However, when I turn on “awake from nib” for each box, the program throws up a NSCannotCreateScriptCommandError(10) error at launch, yet functions perfectly well. If I turn off “awake from nib” for one box, the problem goes away, but this box loses its drag and drop functionality. What might I be doing wrong?

My second issue is that I have a large image inside each box. Right now the images function as a dead zone for drops - I have to drop the files in the blank space of the box in order for them to register. Is there a way to have drag and drop ignore the images all together? Thanks!

Do you really need to use the boxes as drop target?

If not then I’d try this:

  • resize the NSImageViews to fill the whole NSBox areas (make sure they are placed above the Boxes)
  • set outline style of the ImageViews to none
  • set scaling to none (asuming you want ths small pics to be centered)
  • connect the on drop handler to both ImageViews
  • disconnect any handler from the boxes.

The ‘look’ of your app will be the same, but I am pretty sure this should solve both problems …

D.

The problem seems to have dislodged itself. :o I realized that I only had XCode 2.0 installed on this computer and so upgraded to 2.2. I then kept working on an unrelated part of the app, and the problem disappeared on the next compile. Before I posted this thread I had tried setting the two boxes and two images to have drop handlers (this created three errors). Now doing this same setup causes no errors and works perfectly. Strange…

Thanks for the suggestion - if it starts acting up again I’ll give that a shot. I was originally going to do it that way but found that dragging in an image would cause it to incorrectly replace the image that was already there. After digging into Apple’s drag and drop example project I see that an empty “conclude drop” will solve that.

Diggin’ up this topic now :slight_smile:

Is there a way to populate a table view with the items dropped on a box ?

Then i’d like to get the items dropped to do actions on them, but I havent found a way to do that either

… can anyone help ?

thanks :slight_smile: