Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-lcc!ames!husc6!cmcl2!phri!ccnysci!alexis From: alexis@ccnysci.UUCP (Alexis Rosen) Newsgroups: comp.sys.mac.programmer Subject: Re: Bug in resource handling in LSP 2.0 Message-ID: <1141@ccnysci.UUCP> Date: 6 Jan 89 10:59:18 GMT References: <1112@ccnysci.UUCP> <919@husc6.harvard.edu> Reply-To: alexis@ccnysci.UUCP (Alexis Rosen) Organization: City College Of New York Lines: 51 In article <919@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes: >In article <1112@ccnysci.UUCP> alexis@ccnysci.UUCP (Alexis Rosen) writes: > >>The problem: When you want to create your own dialog templates for the >>SFGetFile and SFPutFile routines, you can't. It always uses the DLOG >>-4000 (and the other std. file resources) that it finds in the system > > *FLAME ON* > > Why do you feel honor-bound to blame the environment for your own >stupid mistakes? In Inside Macintosh, Volume 1, Chapter 20 (The Standard File >Package), it explains the following: > [etc., explains difference between SFGetFile & SFPGetFile] > RTFM before you start pointing fingers. Rich, I may be making a mistake, but it sure isn't that one. RTFMessage... I am using the same Resource IDs as are in the system file (-3999 and -4000) for my modified SFGetFile & SFPutFile. This strategy works just fine in LSP 1.0. Furthermore, it works just fine in *LSP 2.0* once I compile it down to a real app. So what's going on??? Leonard Rosenthal suggests I'm not telling LSP to look in my resource file, but I am. He also says: > I hate to disagree with you Alexis, but I just did this the other day using >LSP 2.0 and had NO problems!! If you could post your code, maybe we can find >something there, but I did a SFPGetFile with my own custom filter and dlgHooks >and it worked beautifully (it didn't work when I put it into MPW though, but >that was MY fault!) I'm glad it worked; you don't need this headache, however small it is in the general scheme of things. My guess is that it worked for you because you are using the 'P' versions of the Standard File Package. It seems to me that what is happening here is that LSP 2.0 will use the attached resource file, but the system file seems to be in the search path before the attached resfile. Therefore Leonard's code works because his resources' numbers don't conflict with any in the system file, whereas mine do. This is just a theory, though, I haven't tested it. ( I don't need lectures on programming style. I know the 'SFP' routines are better. But I wrote this code a long time ago and I didn't want to hack on it any in order to get it to compile. ) In the meantime I'm using LSP to write XCMDs and XFCNs for FoxBase. It works very well... FoxBase implements all but two of the HyperCard callback functions. They did a very nice job. Alexis Rosen alexis@ccnysci.uucp