Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Page 1 of 2 12 LastLast
Results 1 to 8 of 9
  1. #1
    redbird is offline Registered User
    Join Date
    Jan 2001
    Location
    Orlando, Florida
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question application:openFile problems

    I'm trying to be able to drag and drop files onto my application, but it's not working and I don't know what I have set wrong.

    I created a regular Cocoa application and am now trying to add this feature and can't.

    In IB, I open MainMenu.nib and connect the File Object to my controller that I want to be the delegate via the delegate outlet. Then, in my controller, I add code for the function application:openFile:. So, seems like everything should work, but when I build I can't drop files onto the icon.

    Any ideas of what might be going on. I'm really hitting my head against the wall on this one and can't seem to figure it out. It's probably some minor detail I'm missing.

    FYI, I've tried the following things (which probably seem silly in light of the right answer):

    - Cleaning all targets and building from scratch
    - putting [NSApp setDelegate: self] in init for my controller
    - putting the method definition for application:openFile in my header file

    Probably some other things I've forgotten playing with the build settings. Any ideas? Thanks

  2. #2
    serving2masters is offline Registered User
    Join Date
    Jan 2002
    Location
    Berkeley, CA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does your app not light up when you drag stuff over it, or does it just fail to open them?

    If it doesn't even light up, make sure you have the target's "application settings"/"document types" filled out with all the things you want to be able to open - I'm pretty sure that's where the OS gets the info from as to what you can open. Just a guess though.

  3. #3
    redbird is offline Registered User
    Join Date
    Jan 2001
    Location
    Orlando, Florida
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by serving2masters
    Does your app not light up when you drag stuff over it, or does it just fail to open them?

    If it doesn't even light up, make sure you have the target's "application settings"/"document types" filled out with all the things you want to be able to open - I'm pretty sure that's where the OS gets the info from as to what you can open. Just a guess though.
    It does not light up. If it did then at least I'd have something to go on.

    I've tried playing with that, but got nowhere. I want my program to open any file, though, so setting it to a certain filetype is not really what I want. At any rate, it doesn't do anything. :-/

  4. #4
    seb2 is offline Registered User
    Join Date
    Jan 2002
    Location
    Germany
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you did set the document types your app handles in target > application settings > document types so that the finder knows your app can handle them?

  5. #5
    serving2masters is offline Registered User
    Join Date
    Jan 2002
    Location
    Berkeley, CA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, here's what you do:

    In the targets's "appication settings"/Document types, create one with "*" as the extension and make sure to set the Document class to the file you want to open it. Then it will let you open everything.

  6. #6
    redbird is offline Registered User
    Join Date
    Jan 2001
    Location
    Orlando, Florida
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by serving2masters
    Okay, here's what you do:

    In the targets's "appication settings"/Document types, create one with "*" as the extension and make sure to set the Document class to the file you want to open it. Then it will let you open everything.
    Okay, I tried this and it still didn't work. Here's how I have things set:

    Name: NSStringPboardType
    Extensions: "*"
    OS Types: "****"
    Icon file:
    Document Class: RRR_Controller
    Viewer

    My application has only one window and not multiple windows, so there is no document class, only my controller. My controller reads in a text file, parses it, and displayes it.

    I took some of these settings from DropScript, but they don't seem to work for me. (the only differences is that mine is a Viewer and has the Document Class set, which DropScript does not).

  7. #7
    serving2masters is offline Registered User
    Join Date
    Jan 2002
    Location
    Berkeley, CA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know. I did that on my desktop and it worked fine, but I'm trying it now on my laptop and it's not working.

  8. #8
    blb
    blb is offline `'
    Join Date
    Apr 2001
    Location
    CO, USA
    Posts
    651
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This may or may not be the case still, but under 10.1 (the last time I added drag/drop to a project), I had to force-restart Finder, as it seems to cache some of this info (as well as the icon).

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. shutdown problems, advice needed
    By Gnomo in forum Mac OS X System & Mac Software
    Replies: 3
    Last Post: April 29th, 2005, 05:32 PM
  2. Disc problems - need some help
    By AdmiralAK in forum Mac OS X System & Mac Software
    Replies: 28
    Last Post: October 23rd, 2003, 10:00 AM
  3. ftp upload problems
    By John Melby in forum Mac OS X System & Mac Software
    Replies: 2
    Last Post: December 16th, 2001, 10:07 AM
  4. Socks firewall problems and Mail firewall problems
    By muldrow in forum Mac OS X System & Mac Software
    Replies: 0
    Last Post: September 28th, 2001, 09:41 PM
  5. Modem problems
    By Henkies in forum Hardware & Peripherals
    Replies: 1
    Last Post: August 31st, 2001, 04:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •