Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: filedata from SFGetFile Message-ID: <9821@hoptoad.uucp> Date: 23 Jan 90 19:11:52 GMT References: <1990Jan16.172725.4367@agate.berkeley.edu> <1201@polari.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 30 OK. I give up. Limit your distribution all you want. No one outside North America really exists anyway. In article <1201@polari.UUCP> robert@polari.UUCP (robert) writes: >> I'm working on a program that opens a number of different file types. >> I want to display the filetype currently selected in the SFPGetFile >> dialog box. Can anyone please tell me how to acieve this? > >I wrote a program recently that does this. It's easy. I used a Filter >function to grab the ParamBlockPtr (and, specifically, to get the >current directory ID number). Then I called PBHGetFInfo in my DlgHook >function, passing the current directory ID number and the file name of >the currently selected file. Below are some code fragments (in Pascal) >with comments. If you want the whole program, send me Email and I'll >mail it to you. It's fairly short and displays the type and creator >in the SFPGetFile box. You're making it awfully hard on yourself. All you're grabbing from the file filter are the volume reference number and directory ID, which are stored in the low-memory globals SFSaveDisk and CurDirStore already. Standard File tracks these as it goes from folder to folder and disk to disk. So all you have to do in your item filter procedure is a PBHGetFInfo using reply.fName together with SFSaveDisk and CurDirStore to find out what the type is; this elaborate snarfing of volume and directory from a file filter procedure is unneccessary. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "The government of the United States is not, in any sense, founded on the Christian religion." -- George Washington