[futurebasic] Re: [FB] Opening files open/save dialog to particular place

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2000 : Group Archive : Group : All Groups

From: George Beckman <gbeckman@...>
Date: Thu, 30 Nov 2000 06:45:36 -0800
on 11/27/00 8:51 PM, Arthur Wood at arthurwood@... wrote:

> Thanks for the reply CZ. I did look in the manual. But when I do as you
> suggest the
> dialog always opens to the last place it was no
> matter that I have changed the default directory to another volume.
> I suspect its something juvenile I'm not doing first. I trudge forward.


Art,

    I had tried to reply to this a couple of days ago and my computer
crashed at the grand moment.

    I worked on this off and on for a year and a half.  You can force this
with the routine below with one exception:  If the user has Last File Used
By Application selected in the General Settings, forget it.  The finder will
not let the rountines do their work.  (Very frustrating.)

(This is a FB II routine.)

    
CLEAR LOCAL MODE
DIM pBlock.128
DIM Noerr&
LOCAL FN SetFilesFolder(Vref%)
  pBlock.ioVRefNum% = Vref%
  
  LONG IF FN GETCATINFO(@pBlock) = _NoErr
    & _CurDirStore , pBlock.ioDirID&
    pBlock.ioWDProcID&  = 0
    pBlock.ioWDVRefNum% = 0
    LONG IF FN GETWDINFO(@pBlock) = _NoErr
      % _SFSaveDisk , -pBlock.ioWDVRefNum%
    END IF
    NoErr&=FN FLUSHVOL(@pBlock)
  END IF
END FN

(This is not mine, but Andy G's.)

The Vref% is the one FB II uses.

Here is a snip from Rick Brown explaining some confusion on the matter.

  '...a Working Directory Reference Number, given a
  '_true_ volume reference number (volumeID) and a directory
  'ID (dirID&).  The wdRefNum should be used in most places
  'where FB documentation talks about a "volume reference number".


I added that note because if you use an alias to get volumeID, that is not
Vref%.  It is supplying the ID of the volume, where Vref% contains more than
that...i.e. the volume and directory.

If you are using an alias, here is the whole Rick Brown routine to convert
Alias informtion to be used with FN SetFilesFolder(Vref%)


_myProcID = _"PGGP"
'-------------------------------------------------
CLEAR LOCAL
DIM iopb.52
DIM OSErr
LOCAL FN GetWDRefNum(volumeID, dirID&,OSErrAddr&)
  'Call as follows:
  '  wdRefNum = FN GetWDRefNum(volumeID, dirID&, @OSErr)
  'Returns a Working Directory Reference Number, given a
  '_true_ volume reference number (volumeID) and a directory
  'ID (dirID&).  The wdRefNum should be used in most places
  'where FB documentation talks about a "volume reference number".
  iopb.ioCompletion& = 0
  iopb.ioNamePtr& = 0
  iopb.ioVRefNum% = volumeID
  iopb.ioWDDirID& = dirID&
  iopb.ioWDProcID& = _myProcID
  OSErr = FN OPENWD(@iopb)
  POKE WORD OSErrAddr&, OSErr
END FN = iopb.ioVRefNum%




-- 
Best Wishes,

George
<mailto: gbeckman@...>
http://www.pggp.com