Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Returning Directories with SFGetFile Message-ID: <6990@hoptoad.uucp> Date: 13 Apr 89 23:38:51 GMT References: <4064@druco.ATT.COM> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 41 In article <4064@druco.ATT.COM> jon@druco.ATT.COM (GotowJK) writes: >I'm writing a little program that needs to prompt the user to select a >directory using SFGetFile. I just posted a long message on doing this a few days ago. Did you see it? I only ask because USENET reliability seemes to be suffering a further decline. >It looks for a hit on the "Directory" >button, returning an "Open" and then a "Cancel" to the SFGetFile filter >proc when it gets one. This effectively descends into the selected >directory and then exits, so I can subsequently use the values in the >SFSaveDisk and CurDirStore globals to find out what the selected >directory was. Notice this approach does not allow specification of a volume top-level as the desired directory. >How do I do this smoothly?? Is there another system global (which I >know I'm not supposed to use) which points to the selected string in >the SFGetFile dialog? No, but if you'll look at Inside Mac volume IV, you'll see that the directory id is stashed in the fType field of the reply record. Your item filter can easily stash this field in a program global and you can then use it after returning from SFPGetFile. However, I think that Mac developers ought to standardize on using the *current* directory rather than the *selected* directory when a directory is chosen using SFPGetFile. This approach is more general, can be idiot-proofed (by disabling the "Folder" button when a folder is selected in the list), and in my opinion is more intuitive. Finally, please remember that "Directory" is a jargon term that should not appear in your user interface! Use the term "Folder" instead. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "I was brought up in the other service; but I knew from the first that the Devil was my natural master and captain and friend. I saw that he was in the right, and that the world cringed to his conqueror only from fear." - Shaw, "The Devil's Disciple"