[comp.sys.mac.programmer] FilterProc with Standard File

brian@natinst.com (Brian H. Powell) (05/11/89)

     We want to use our own FilterProc (not the file-filter type, but the
modal dialog type) with Standard file (SFPGetFile, SFPPutFile).
     The problem is that we lose the ability to handle things like
	* typing scrolls the list of files
	* arrow keys scrolling the list of files
	* tab switches disks
	* popup on the folder name shows you a list of folders
	* etc.  (You know, all the normal stuff you usually see.)

     How can we get all this behavior and have our own filterProc also?  It
appears that Standard File is using it's own filterProc if you don't supply
one, and it does most of this stuff for you.  The Proc is in the middle of the
PACK resource somewhere, so there's no convenient way of programmatically
getting to the right code.

     Any suggestions, either on how to get the Mac to do what we want
directly, or on how to duplicate the operation of the Standard File filter in
our own filter?

     Thanks in advance.

Brian H. Powell					National Instruments Corp.
	brian@natinst.com			12109 Technology Blvd.
	uunet!cs.utexas.edu!natinst!brian	Austin, Texas 78727-6204
	AppleLink:NATINST			(512) 250-9119

keith@Apple.COM (Keith Rollin) (05/12/89)

In article <2768@natinst.natinst.com> brian@natinst.com (Brian H. Powell) writes:
>     We want to use our own FilterProc (not the file-filter type, but the
>modal dialog type) with Standard file (SFPGetFile, SFPPutFile).
>     The problem is that we lose the ability to handle things like
>	* typing scrolls the list of files
>	* arrow keys scrolling the list of files
>	* tab switches disks
>	* popup on the folder name shows you a list of folders
>	* etc.  (You know, all the normal stuff you usually see.)
>
>     How can we get all this behavior and have our own filterProc also?  It
>appears that Standard File is using it's own filterProc if you don't supply
>one, and it does most of this stuff for you.  The Proc is in the middle of the
>PACK resource somewhere, so there's no convenient way of programmatically
>getting to the right code.
>
>     Any suggestions, either on how to get the Mac to do what we want
>directly, or on how to duplicate the operation of the Standard File filter in
>our own filter?
>
Brian,

The Sample Code disks (yes, there are two in the next batch) will contain
a sample chock(sp?) full of SF samples. In the meantime, you should be able to
do what you want. Without seeing your program, I don't know for sure what is
going on, or even which filter your are trying to use (there are actually 3).
If you are really using the ModalDialog filter, then it sounds like you aren't
returning TRUE, saying that you didn't handle the event and that someone else
should. In this case, that someone else is Standard File.

I demonstrate all 3 kinds of filtering in this sample program, so you should be
able to find what you need there. It is on Phil and Dave's Excellent CD, which
will be mailed to all developers soon (if you didn't get it at the Developer's
Conference).

------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions

tim@hoptoad.uucp (Tim Maroney) (05/13/89)

In article <2768@natinst.natinst.com> brian@natinst.com (Brian H. Powell)
writes:
>     We want to use our own FilterProc (not the file-filter type, but the
>modal dialog type) with Standard file (SFPGetFile, SFPPutFile).
>     The problem is that we lose the ability to handle things like
>	* typing scrolls the list of files
>	* arrow keys scrolling the list of files
>	* tab switches disks
>	* popup on the folder name shows you a list of folders
>	* etc.  (You know, all the normal stuff you usually see.)

I've written lots of these filter procs (my software uses hacked Standard
File more often than the vanilla version, truth to tell) and I've never
seen these problems, so I have to think your filter proc is in error.

Most likely you are returning true when you mean false and vice versa;
if you return true on keyboard and mouse events that you aren't handling
yourself, you'd get the behavior described above.

>     Any suggestions, either on how to get the Mac to do what we want
>directly, or on how to duplicate the operation of the Standard File filter in
>our own filter?
>
>     Thanks in advance.

You're welcome in advance; hope this does the trick for you.
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
"Now hear a plain fact: Swedenborg has not written one new truth: Now hear
  another: he has written all the old falshoods.
 And now hear the reason.  He conversed with Angels who are all religious, &
  conversed not with Devils who all hate religion..."
    - Blake, "The Marriage of Heaven and Hell"