ADC Home > Reference Library > Technical Notes > Legacy Documents > User Experience >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Standard File Package directory defaultsDate Written: 1/22/93 Last reviewed: 6/14/93 When I double-click a document that launches my application, the current directory for the Standard File package (at location $398 in memory) is set to the directory of my application and not my document. This seems to be a bug according to the text on page 3-31 of the new Inside Macintosh: Files manual. Is there anything special I have to do? ___ You're right. The behavior described in Inside Macintosh: Files isn't entirely correct. It should say that the first time your application calls one of the Standard File Package routines, the default current directory (that is, the directory whose contents are listed in the dialog box) is determined by the way your application was launched. * If the user launched your application directly (perhaps by double-clicking its icon in the Finder), the default directory is the directory in which your application is located. * If the user launched your application indirectly (perhaps by double-clicking
one of your application's document icons) and your application is passed Finder
information, the default directory is the directory of the last document listed
in the Finder information. The Finder information is the data referenced by
Note that applications that are high-level event aware are passed the list of
documents to open or print in a Dialog filter control with subdialog boxesDate Written: 12/10/92 Last reviewed: 6/14/93 My routine uses a dialog hook to set and retrieve certain values in new items
added to the default box. Previously, with ___ Both Standard File and the Edition Manager in System 7 allow you to have control in your filter when one of the subdialog boxes comes up. You can differentiate between the main dialog and the subdialogs by looking in the refCon field of the dialog record passed to you. In Standard File's case, if the dialog is the main dialog, the refCon will be:
This is described in detail on page 26-18 of Inside Macintosh Volume VI, in the middle of the section that describes all the callbacks and pseudo items for Standard File under System 7. The main purpose of this is to allow your additional dialog items to react properly when another dialog box is brought up in front of them, not to allow you access to the subdialogs. Also, since Standard File has no idea what types of items you've added to the dialogs, giving you control during subdialogs allows you to change the look of your subitems, or to keep them active if they need periodic time for any reason. Working around Standard File quirk when system heap is fullDate Written: 12/4/91 Last reviewed: 6/14/93 Standard File can fail to function properly when the system heap is very full; it just returns false in the reply.good field. This is a serious problem for us because we are unable to detect this situation; to our application, it just looks like the user clicked the Cancel button. Do you have any suggestions for working around this? ___ This is a significant problem, but we can't guarantee that the software will
perform in any imaginable set of circumstances you want to set up. You're going
to have to check to see if it will be able to work (preflight it) and then see
if it fails. In virtually all such failure cases, the low-memory globals Custom Standard File dialog edit fields under System 7Date Written: 8/14/91 Last reviewed: 6/14/93 How do I change the active edit field inside a custom Standard File dialog under System 7? In a related problem I am finding that the selection range for all edit fields in the dialog equals the number of characters in the file name field when tabbing around. ___ The Standard File Package (SFP) routines don't behave exactly the same as they
did under System 6. Therefore, doing something like trying to change the active
item number doesn't work under System 7's version of the SFP routines. The
problem is that System 7 Standard File has a whole set of interfaces dedicated
to the active item list and which item is currently active, whereas System 6 SF
routines just use the dialog data to store this information. The solution to
the problem, then, is to use Your second problem is brought on by a bug in Standard File. The workaround is to install an activate procedure for Standard File (it's a parameter to the CustomGetFile call) which calls SelIText on the appropriate field to select the entire range. The included sample also does this.
Displaying invisible files under Systems 6 & 7 without typeListDate Written: 8/9/91 Last reviewed: 6/14/93 Under System 7 my filter procedure for displaying invisible data files no longer works. How can I use Standard File to display the names of invisible files of a specific type under System 7? ___ System 7 can show invisible files in the standard When using invisible files under System 7, you should perform type filtering
within a filter proc and not with the The
In this example, the filter proc's return value depends on the file's type and Finder flags.
Standard File and nontrashable Macintosh foldersDate Written: 7/24/91 Last reviewed: 6/14/93 When we use Standard File to get a Macintosh file in a folder, it becomes impossible to throw that folder away and empty the trash without quitting first. Is this because the working directory is still open? It is my understanding that applications shouldn't close working directories that were opened by Standard File. Is there something I should be doing, or is this just a limitation in the system? ___ Pre-System 7 Standard File calls (SFGetFile/SFPutFile/etc...) call PBOpenWD to open a working directory to the folder where the selected file resides. This working directory, along with all others created within any application, are closed by MultiFinder (or the Process Manager under System 7) when the application is quit. Before the application quits, you will not be able to throw away the folder. After quitting, however, the directory is closed and the folder can be trashed. As described in the Macintosh Technical Note
"Working Directories and MultiFinder," this is accomplished in the following way:
When Standard File calls Your understanding is correct that you don't have to close these Standard File
working directories yourself. If, however, you want the user to be able to
delete the directory while your application is still running, you will
have to issue a
If you're running under System 7, you are much better off using the new
If none of the above helps, your problem may be that you have left a file open in the directory the user is trying to delete. This would cause the same error as the one you described. How to override System 7.0 Standard File dialog centeringDate Written: 6/19/91 Last reviewed: 8/1/92 Any way to override the new default screen location (upper-middle) for Standard File calls under System 7.0? My Standard File dialog needs to be somewhere else on the screen. ___ You can use the Tabbing between SFPPutFile custom dialog text fieldsDate Written: 6/7/91 Last reviewed: 8/1/92 How can I get the tab key to tab between text fields in my SFPPutFile custom dialog instead of switching drives? ___ Here is an event filter that beeps whenever the tab key is pressed (under System 6):
Within dialog event filters, when the filter decides to process the event, the filter not only must return true, but must also return the item number acted on by the filter. Under System 7, tab is handled by the system automatically and is not controllable from dialog event filters. Filtering out invisible folders from a Standard File dialog listDate Written: 6/10/91 Last reviewed: 6/14/93 I want to display only visible files and folders in a Standard File dialog, but
I can't find a way to filter out invisible folders--specifically the 000Move&Rename folder.
The ___ This is, in fact, impossible under System 6 using general methods. The problem is that passing -1 as numTypes means not only to display all items, but to display invisible items. A file filter can be used to remove the invisible files but cannot affect invisible folders. The only current way to do this is to use CustomGetFile under System 7, as described in the Standard File Package chapter of Inside Macintosh Volume VI. This provides a filter that allows you to filter both files and folders. This will give you the right functionality, but will work only under System 7. We recommend that you use this method under System 7, and a more standard SFGetFile when running under earlier systems. File handling within SFPGetFile & SFPPutFile DlgHook functionsDate Written: 4/2/91 Last reviewed: 8/1/92 How can I obtain the volume reference information in my DlgHook function for a file selected by the user before SFPPutFile or SFPGetFile has completed the reply record? ___ On exit, We suggest that, unless you plan to support the flat file system of 64K ROM
Macintosh systems, you move your file system interfaces to the HFS interfaces
documented in the File Manager sections of Inside Macintosh Volumes IV
and V (or to the equivalent high-level calls as documented in the Macintosh
Technical Note "New High-Level File Manager Calls"). If you're using the HFS
calls, low-memory globals Moving your file system interfaces to the HFS-level conventions has a side benefit of being closer to the System 7 file system specifications. If you look at the new high-level file system calls in Inside Macintosh Volume VI, you'll recognize much of the HFS information embedded in the new data structures. If your file system interfaces depend on MFS-style Complete information on the HFS-level calls that will be most useful in Standard File customization is contained in the File Manager chapters of Inside Macintosh Volumes IV and V, and in the Macintosh Technical Notes "Determining Which File System Is Active," "HFS Ruminations," "HFS Elucidations," "Why PBHSetVol is Dangerous," "Setting ioNamePtr in File Manager Calls," and "Working Directories and MultiFinder." For C users, the Macintosh Technical Note "Mixing HFS and C File I/O" summarizes a list of the difficulties with mixing C file I/O with Macintosh file I/O. Macintosh Technical Notes "Customizing Standard File" and "Standard File Tips" discuss a few points of Standard File customization from the point of view of HFS. What to do instead of nested SFPGetFile callsDate Written: 1/14/90 Last reviewed: 2/6/91 I am nesting two Macintosh ___ The SF package is not re-entrant, so there isn't really a way to do what you want here. MOST of the information is kept around when you nest calls, but the main problem is in the resources SF uses for the items. When the nested SF dialog closes (on a cancel, for example) it releases the resources that Standard File is using. Unfortunately, this also releases the resources that are being used by the original dialog, so that's where your items are getting messed up. And while there is potentially a workaround by doing some kludgy stuff, I can guarantee that anything I tell you now will be completely wrong under System 7.0, so I can't do that. However, you can use sequential calls, instead of nested. This is a little more of a pain, but it'll work. Call Working directory not necessary for new Macintosh applicationsDate Written: 12/12/90 Last reviewed: 8/1/92 Why does closing the working directory also close it for other users? ___ It is not necessary to use "Working Directories." When the Macintosh first came out there was no notion of directories. MFS was a flat file system; all files were stored in a single directory. Hence, all of the original applications specified a file by its name and the volume it was on. In other words, a vRefNum and a fileName. The Hierarchical File System (HFS) introduced the concept of directories to
the Macintosh. This meant that applications now had to specify a directory ID along
with the In other words, working directories are for providing compatibility within the
file system for old (pre-HFS) applications. New applications and XCMDs
shouldn't be creating or using them. Standard File still returns working
directories, and you can use those, but it is recommended to convert them into
real But what if you do use working directories? Under MultiFinder, the ioWDProcID
field is filled in with the process ID that MultiFinder creates when it launches
a new application. When you create a working directory, an entry is created for
each XRef: DTS Macintosh Technote "Getting a Full Pathname" How to control path used by SFGetFileDate Written: 11/1/90 Last reviewed: 8/1/92 I would like to be able to control which path ___ To set the directory for standard file dialogs, set the low memory
global
or in C:
This is documented in the Macintosh Technical Note "Standard File Tips."
Note that the Saving correct Macintosh "user file last used" informationDate Written: 11/17/89 Last reviewed: 8/1/92 I save the vRefNum returned by Standard File so I can easily get back to the file the user last used, but why do I sometimes get "file not found" errors when I try to open the file? ___ What you have to remember is that under HFS, What you should do is translate the This is the best you can do to save file information for later use under System 6. Under System 7, create and store an alias for the FSSpec returned by Standard File and use that to later locate the file. Downloadables
|
|