gross@watdcsu.UUCP (Evan Gross [Sys Des]) (01/16/85)
I'm having some problems using a dialog hook procedure with SFGetFile, and am wondering if anyone else out there has encountered something similar. I have also discovered something useful that is undocumented (package manager 2nd draft 5/7/84). The problem (I think it's a bug in SFGetFile): IM says that when a disk inserted event occurs, SFGetFile's filterProc function sends an item number of 100 to your dlgHook function. Well, I have found that it is repeatedly sends 100 to dlgHook, (disk inserted or not) although all other events do come through ok. So, it seems at present there is no way to detect a disk inserted event this way. If and when Apple fixes this problem, I vote for changing the item number for a disk inserted event from 100 to 100 + drive number, in a manner similar to reporting key down events to dlgHook. Sound reasonable? The undocumented feature (not a bug): Just before the SFGetFile dialog box is put up, the dlgHook function is sent an item number -1. This is great if you want to change the title of a control before the dialog box is drawn...say changing the "Open" button to read "Print" or something like that. This allows one to change the appearance of the standard dialog on the fly, without making up a new template and using it instead. (Lots of programs do this...MacTerminal, all the MDS stuff, Consulair C, etc. IM just doesn't tell you how). Evan Gross watmath!watdcsu!gross Rainmaker Research Inc.
lsr@apple.UUCP (Larry Rosenstein) (01/24/85)
In article <watdcsu.832> gross@watdcsu.UUCP (Evan Gross [Sys Des]) mentions
a bug with SFGetFile. I talked to Tech Support and found that they know
about the problem and have a work around.
The problem is if you use a dialog hook with SFGetFile it will receive a
100 code for disk-inserted events as well as null events. That is why 100
is continually being sent.
The workaround is for your dialog hook to call OSEventAvail with an
appropriate event mask, to see if there is a disk-inserted event in the
queue. You can ask for all kinds of events to see if the disk-inserted is
next in the queue, or only disk-inserted to see if it is somewhere in the
queue. I will pass along the suggested fix (send 100+drive #) to the
people in charge of such things.
The undocumented feature (the dialog hook is passed -1 when the dialog box
is put up) was also known, and should be documented in the next release of
the Package Manager manual.
Thanks for the bug report.
Larry Rosenstein
UUCP: {dual, nsc, voder, ios}!apple!lsr
CSNET: lsr%Apple@CSNET-RELAY
"The Expandable Application: We do the programming so you don't have to."