[comp.sys.next] OpenPanel, messages, & such

dz@pumpkin.ucsb.edu (Daniel James Zerkle) (09/12/89)

Thanks to the two folks who responded to an earlier message, I now
know how to use NXAlert() to put up a little panel requiring a
response from the user.  It works great.  Here's a couple more things.

1. I still want to use the OpenPanel to select a *directory*.  I can
   get the directory if a file is selected, but that is not what I
   want.  By subclassing -text:isEmpty: (see SavePanel) to do nothing
   but return itself, I keep the OK button enabled, and I subclass
   +new to manually enable the OK button on startup.  The only problem
   is that hitting the OK button when there is no text on the file name
   line (i.e. a directory is selected) does nothing but disable the
   button and nothing more.  It doesn't return or set the directory.

   What I thing I should do is subclass the -ok method (see SavePanel),
   which is the target of the ok button of the OpenPanel.  The only
   problem is that I don't want to add functionality.  I want to
   *remove* it.  If I could subclass it so that it would not check
   to see if there is a file selected before returning, and would not
   disable the ok button, that would be wonderful.  I don't, however,
   have the source, and can't figure out what is going on well enough
   to rewrite everything.  I can't use [super ok:sender] because that
   would do the checking I don't want.

   I tried to use the delegate (doc'ed in SavePanel) and the method
   -validateFilename: to unconditionally accept everything, but that
   didn't work.

2. Can anybody figure out what to do with -setFileFilterFunc: and
   -fileFilterFunc?  They are not documented well, and there is no
   example.  I think the docs for -fileFilterFunc are actually wrong.
   I found this in <appkit/OpenPanel.h>:

typedef (*NXFileFilterFunc)(id self, NXDirEntry *dirEntry)

and in <appkit/SavePanel.h>:

typedef struct _NXDirEntry {
  [12 lines of mysterious stuff, including mode & inode deleted]
} NXDirEntry;

3. Is there a clever way to display a status (not error) message in
   a little panel that will pop up on the screen.  NXAlert() is fine
   for error messages or for when I want a response, but is there
   something that does not require a response from the user, and that
   I can keep up while the program continues to run, then make go
   away?

| Dan Zerkle home:(805) 968-4683 morning:961-2434 afternoon:687-0110  |
| dz@cornu.ucsb.edu dz%cornu@ucsbuxa.bitnet ...ucbvax!hub!cornu!dz    |
| Snailmail: 6681 Berkshire Terrace #5, Isla Vista, CA  93117         |
| Disclaimer: If it's wrong or stupid, pretend I didn't do it.        |