[net.micro.mac] Request for help with Standard File

carlton@ernie.Berkeley.EDU (Mike Carlton) (08/19/86)

I'm using SFGetFile, (actually SFPGetFile, which is the same except that I'm
giving it a custom dialog), and I want to present one of two groups of files,
based on which of a pair of radio buttons is active.  What I've done is told
SFGetFile to display all types of files, and then I use the file filter 
procedure to filter out one of the two groups after it reads the status of
the radio buttons.  

The problem comes when the user hits the other radio button: I want the file 
list to display a different group of files now.  So, I need SFGetFile to read 
the volume info again and call my file filter for each file.  These are the 
same actions as if you hit the Drive button, but it must apply to the current
disk.

Any ideas on how to do this?  I've tried posting a disk event for the drive
holding the current disk (thinking to fool SF by telling it the disk has just
been inserted), but it either ejects the disk or ignores the event.  I've also
tried decrementing the global value SFSaveDisk (which contains the current disk
number) and telling SF that the Drive button was hit, but it ignores the value
and just writes a new value after cycling to the next drive.

Just to make things more interesting, it needs to be done in a "safe" way, e.g.
no jumping into the code of Pack3, as there are already at least 2 versions of
Standard File and there may be more.

Thanks in advance for any ideas.

Mike Carlton

"Bugs Mr. Rico, zillions of them"  -- Starship Trooper

lsr@apple.UUCP (08/20/86)

In article <15332@ucbvax.BERKELEY.EDU> carlton@ernie.Berkeley.EDU (Mike Carlton) writes:
>
>I'm using SFGetFile, (actually SFPGetFile, which is the same except that I'm
>giving it a custom dialog), and I want to present one of two groups of files,
>based on which of a pair of radio buttons is active.  What I've done is told
>SFGetFile to display all types of files, and then I use the file filter 
>procedure to filter out one of the two groups after it reads the status of
>the radio buttons.  
>
>The problem comes when the user hits the other radio button: I want the file 
>list to display a different group of files now.  So, I need SFGetFile to read 
>the volume info again and call my file filter for each file.  These are the 
>same actions as if you hit the Drive button, but it must apply to the current
>disk.
>

Just return to Standard File a fake item number 101.  This will cause it to
re-read the directory and re-filter the files.  This is mentioned in Inside
Mac Volume IV (IMVIV), and will be supported in the future.


-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.CSNET

tomas@apple.UUCP (08/20/86)

In article <15332@ucbvax.BERKELEY.EDU> carlton@ernie.Berkeley.EDU (Mike Carlton) writes:
>
>I'm using SFGetFile, (actually SFPGetFile, which is the same except that I'm
>giving it a custom dialog), and I want to present one of two groups of files,
>based on which of a pair of radio buttons is active.  What I've done is told
>SFGetFile to display all types of files, and then I use the file filter 
>procedure to filter out one of the two groups after it reads the status of
>the radio buttons.  
>
>The problem comes when the user hits the other radio button: I want the file 
>list to display a different group of files now.  So, I need SFGetFile to read 
>the volume info again and call my file filter for each file.  These are the 
>same actions as if you hit the Drive button, but it must apply to the current
>disk.
>
>Any ideas on how to do this?  I've tried posting a disk event for the drive
>holding the current disk (thinking to fool SF by telling it the disk has just
>been inserted), but it either ejects the disk or ignores the event.  I've also
>tried decrementing the global value SFSaveDisk (which contains the current disk
>number) and telling SF that the Drive button was hit, but it ignores the value
>and just writes a new value after cycling to the next drive.
>
>Just to make things more interesting, it needs to be done in a "safe" way, e.g.
>no jumping into the code of Pack3, as there are already at least 2 versions of
>Standard File and there may be more.
>
>Thanks in advance for any ideas.
>
>Mike Carlton
>
>"Bugs Mr. Rico, zillions of them"  -- Starship Trooper

To make SFGetFile or SFPGetFile redraw the whole list simply have the
Dialog Hook routine return 101.  Macintosh Technical Note #47 describes your
exact situation and even has the source code to an example.

Tom Taylor