slang@bmerh563.bnr.ca (Steven Langlois) (03/15/91)
I seem to be unable to control the location of a file icon. In particular when I am overwritting a file, I call FSDelete to delete the file and FSCreate to create a new file with the same name. Before I delete the file with FSDelete, I save the location of the icon using location := paramBlock.ioFlFndrInfo.fdLocation. After I recreate the file I call PBGetFInfo to get the paramBlock of the newly created file and then attempt to reset the location of the newly created file to the saved location by using paramBlock.ioFlFndrInfo.fdLocation := location and then calling PBSetFInfo to set the location of the icon to that of the original file. This does not seem to work. Does anybody know what I am doing wrong. Thanks, Steven Langlois ISDN Basic Rate Access BNR, a subsidiary of Northern Telecom Bitnet: slang@bnr.ca Bitnet from AppleLink: slang@bnr.ca@DASNET#
urlichs@smurf.sub.org (Matthias Urlichs) (03/18/91)
In comp.sys.mac.programmer, article <1991Mar15.145457.278@bmers95.bnr.ca>,
slang@bmerh563.bnr.ca (Steven Langlois) writes:
<
< I seem to be unable to control the location of a file icon. In particular
< [...]
< paramBlock.ioFlFndrInfo.fdLocation := location and then calling
< PBSetFInfo to set the location of the icon to that of the original
< file. This does not seem to work. Does anybody know what I am doing
< wrong.
<
Yes.
The Finder remembers whether it has seen the file, and hence whether the info
about the location is believable. It's the "inited" bit. You probably should
copy all of these bits along with the position. In fact you can safely copy
the whole finder info, not just the location.
--
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49-721-621127(0700-2330) \o)/
gurgle@well.sf.ca.us (Pete Gontier) (03/18/91)
In article <1991Mar15.145457.278@bmers95.bnr.ca> slang@bmerh563.bnr.ca (Steven Langlois) writes: >I seem to be unable to control the location of a file icon. In particular >when I am overwritting a file, I call FSDelete to delete the file and >FSCreate to create a new file with the same name. Before I delete the >file with FSDelete, I save the location of the icon using >location := paramBlock.ioFlFndrInfo.fdLocation. After I recreate the >file In my experience with MultiFinder, I have found that most of the Finder information can be dependably written only by, you guessed it, the Finder. It's got its own internal representation of how things should look, and only under certain circumstances does it actually go out and take a look at the file system to refresh its memory. To see if you are suffering from this problem, you could try running your program under UniFinder. I have two ideas for solutions: 1) Set the modification date when you set the icon position. If that doesn't work, set the modification date of the parent directory after setting the icon position. This may give the Finder the swift kick in the pants it needs. But this sounds like an awful lot of work. 2) Don't delete the old file and create a new one. Just open the old file and SetEOF it to 0. Same effect, roughly. -- Pete Gontier, gurgle@well.sf.ca.us Software Imagineer, Kiwi Software, Inc.