home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!spsgate!mogate!newsgate!NewsWatcher!user
- From: rtmd30@email.sps.mot.com (Greg Ferguson)
- Subject: Stabbing SFGetFile in the back...
- Message-ID: <rtmd30-151292223311@220.1.50.175>
- Followup-To: comp.sys.mac.programmer
- Sender: usenet@newsgate.sps.mot.com
- Nntp-Posting-Host: 220.1.50.175
- Organization: Motorola
- Date: Wed, 16 Dec 1992 05:54:04 GMT
- Lines: 81
-
-
- Hi,
-
- Here's what I've done:
-
- My SFPGetFile() has a custom dialog with a new button. My dialog hook
- watches for the click on the button. When the button is clicked, I use
- FindFolder() to locate the current System/Prefs folder. Once I have that I
- locate QuickMail Stuff (yeh, I'm hacking on QuickMail) using...
-
- void SetSFCurDir(long dirID)
- {
- CurDirStore = dirID;
- }
-
- void SetSFVRefNum(short vRefNum)
- {
- SFSaveDisk = -vRefNum;
- }
-
- /*
- * Use FindFolder() to locate the prefs folder. Then set the default
- * system volume and folder to the boot volume and prefs folder and return.
- */
- void DoGoToPrefs(void)
- {
- CInfoPBRec myCPB;
- long foundDirID;
- OSErr iErr;
- short vRefNum;
-
- iErr = FindFolder(kOnSystemDisk, // look on the system disk...
- kPreferencesFolderType, // ...for the preferences folder and...
- kDontCreateFolder, // ...don't create it if it's not there.
- &vRefNum,
- &foundDirID);
- if (iErr == noErr) // if the prefs folder was found then
- // try finding the QuickMail folder
- {
- myCPB.dirInfo.ioVRefNum = vRefNum;
- myCPB.dirInfo.ioFDirIndex = 0;
- myCPB.dirInfo.ioNamePtr = "\p:QuickMail Stuff:";
- myCPB.dirInfo.ioDrDirID = foundDirID;
- iErr = PBGetCatInfo(&myCPB, FALSE);
- if (iErr == noErr)
- {
- SetSFVRefNum(myCPB.dirInfo.ioVRefNum); // point to QM's Stuff ─
- SetSFCurDir(myCPB.dirInfo.ioDrDirID);
- } else
- {
- SetSFVRefNum(vRefNum); // point to the prefs ─
- SetSFCurDir(foundDirID);
- }
- }
- }
-
-
- When I return to my dialog hook, I return a 101 (sfHookRebuildList).
- Standard File then displays the correct folders and files in the list. Ok,
- all that seems to work fine.
-
- What's bugging me is that Standard File isn't updating the drive name if my
- previous path was on another drive. I can click on the drive name/icon
- (item 4 in the SFGet/PutFile() dialog) until my carpal-tunnels swell but
- the drive info won't update until SF displays the desktop level.
-
- Am I missing a value to return from the dialog hook that'll tell SF to wake
- up and smell the drive? Or, heaven forbid, do I need to do a GetDItem() on
- the item 4 (Drive ICON and name) in the SFPGetFile() dialog just to get the
- handle to the procedure which is handling the redraw of that field? And
- then jump into that procedure?
-
- Inquiring minds want to know... and thanks,
-
- Greg
-
- Greg Ferguson
- Programmer/Engineer
- Desktop Networking System
- SPS, World Marketing
- Motorola, Inc.
-