Drop Zone Validator with Aquatic Prime

Discussion in 'Mac Programming' started by Darkroom, Apr 18, 2008.

  1. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    i found a very nice podcast from cocoacast.com on how to set up Aquatic Prime in an application...

    link is here: http://www.cocoacast.com/?q=node/179 - the presenter has a cool french accent too ;)

    the sample app that is made uses an NSTextField, where the user will copy the .plist text code (license code from Aquatic Prime) into the text field and press the "validate" button...

    but i'd like to know how to make an NSTextView to a drop zone to accept the .plist file, and have the "validate" button automatic on drop... i have been combing the internet in search of a tutorial, but i can't seem to find one that isn't super advanced... so far i'm under the impression that NSPasteBoard is involved...

    anyone know of a good tutorial concerning turning an NSTextView into a drop zone for files?
     
  2. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #2
    Look at this sample code: https://home.devklog.net/svn/mpqdraft/cocoa/FileDropView.m

    NSTextView is based on NSView so you can subclass NSView add stuff to it like accepting a file drop. You would need to link the droped file to Aquatic Prime for processing and then show some result in NSTextView.

    Of course you can always just make a button and do an NSOpenPanel route.

    Drag 'n' drop should be a shortcut, not the default method to do stuff. Users may have a bunch of windows open, multiple spaces, multiple monitors etc. so dragging a file from some random place to your window may be more work than just using the mini-Finder view in the NSOpenPanel.
     
  3. mduser63 macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #3
    You should also (IMO) associate the file type of your license file with your app so that double clicking it will automatically open the license file in your app and register the app.
     
  4. Senor Cuete macrumors regular

    Joined:
    Nov 9, 2011

Share This Page