home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19894 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.7 KB  |  94 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!spsgate!mogate!newsgate!NewsWatcher!user
  3. From: rtmd30@email.sps.mot.com (Greg Ferguson)
  4. Subject: Stabbing SFGetFile in the back...
  5. Message-ID: <rtmd30-151292223311@220.1.50.175>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: usenet@newsgate.sps.mot.com
  8. Nntp-Posting-Host: 220.1.50.175
  9. Organization: Motorola
  10. Date: Wed, 16 Dec 1992 05:54:04 GMT
  11. Lines: 81
  12.  
  13.  
  14. Hi,
  15.  
  16. Here's what I've done:
  17.  
  18.      My SFPGetFile() has a custom dialog with a new button. My dialog hook
  19. watches for the click on the button. When the button is clicked, I use
  20. FindFolder() to locate the current System/Prefs folder. Once I have that I
  21. locate QuickMail Stuff (yeh, I'm hacking on QuickMail) using...
  22.  
  23. void SetSFCurDir(long dirID) 
  24. {
  25.     CurDirStore = dirID; 
  26. }
  27.  
  28. void SetSFVRefNum(short vRefNum)
  29. {
  30.     SFSaveDisk = -vRefNum;
  31. }
  32.  
  33. /*
  34.  *    Use FindFolder() to locate the prefs folder. Then set the default
  35.  *    system volume and folder to the boot volume and prefs folder and return.
  36.  */
  37. void DoGoToPrefs(void)
  38. {
  39.     CInfoPBRec    myCPB;
  40.     long        foundDirID;
  41.     OSErr        iErr;
  42.     short        vRefNum;    
  43.     
  44.     iErr = FindFolder(kOnSystemDisk,    // look on the system disk...
  45.         kPreferencesFolderType,            // ...for the preferences folder and...
  46.         kDontCreateFolder,                // ...don't create it if it's not there.
  47.         &vRefNum,    
  48.         &foundDirID);
  49.     if (iErr == noErr)                    // if the prefs folder was found then
  50.                                         // try finding the QuickMail folder
  51.     {
  52.         myCPB.dirInfo.ioVRefNum = vRefNum;
  53.         myCPB.dirInfo.ioFDirIndex = 0;
  54.         myCPB.dirInfo.ioNamePtr = "\p:QuickMail Stuff:";
  55.         myCPB.dirInfo.ioDrDirID = foundDirID;
  56.         iErr = PBGetCatInfo(&myCPB, FALSE);
  57.         if (iErr == noErr)
  58.         {            
  59.             SetSFVRefNum(myCPB.dirInfo.ioVRefNum);    // point to QM's Stuff ─
  60.             SetSFCurDir(myCPB.dirInfo.ioDrDirID);
  61.         } else 
  62.         {
  63.             SetSFVRefNum(vRefNum);        // point to the prefs ─
  64.             SetSFCurDir(foundDirID);
  65.         }
  66.     }
  67. }
  68.  
  69.  
  70. When I return to my dialog hook, I return a 101 (sfHookRebuildList).
  71. Standard File then displays the correct folders and files in the list. Ok,
  72. all that seems to work fine.
  73.  
  74. What's bugging me is that Standard File isn't updating the drive name if my
  75. previous path was on another drive. I can click on the drive name/icon
  76. (item 4 in the SFGet/PutFile() dialog) until my carpal-tunnels swell but
  77. the drive info won't update until SF displays the desktop level.
  78.  
  79. Am I missing a value to return from the dialog hook that'll tell SF to wake
  80. up and smell the drive? Or, heaven forbid, do I need to do a GetDItem() on
  81. the item 4 (Drive ICON and name) in the SFPGetFile() dialog just to get the
  82. handle to the procedure which is handling the redraw of that field? And
  83. then jump into that procedure?
  84.  
  85. Inquiring minds want to know... and thanks,
  86.  
  87. Greg
  88.  
  89. Greg Ferguson
  90. Programmer/Engineer
  91. Desktop Networking System
  92. SPS, World Marketing
  93. Motorola, Inc.
  94.