gosub BrowseDir
Message("Selected Directory",Directory)
exit


;******************************************************************************
;
;                                  BROWSEDIR
;  Generates a directory browsebox with two pushbuttons, SELECT & CANCEL.
;
;  Calling Sequence:
;  Directory = Name of directory to display first (DEFAULT = "c:\")
;  gosub BrowseDir
;
;  Output Parameters:
;  Directory - lowercase directory name selected. NULL if CANCEL pressed.
;
;  Notes:
;  This subroutine can be used in conjunction with GetDir or by itself.  Since
;  the dialog box does not return a real filename, the IntControl(4,0,0,0,0)
;  function must be used.  See WIL Reference manual.
;
;******************************************************************************

  :BrowseDir

    if !IsDefined(Directory) then Directory="c:\"
    DirChange(Directory)
    DefDir="[*]"
    IntControl(4,0,0,0,0)

    BrowseDirFormat=`WWWDLGED,4.0`
    BrowseDirCaption="Directory Browse"
    BrowseDirX=2000
    BrowseDirY=2000
    BrowseDirWidth=140
    BrowseDirHeight=108
    BrowseDirNumControls=5
    BrowseDir01=`60,10,70,74,FILELISTBOX,DefDir,DEFAULT`
    BrowseDir02=`8,16,40,DEFAULT,PUSHBUTTON,DEFAULT,"&Select",2`
    BrowseDir03=`8,40,40,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",1`
    BrowseDir04=`14,90,42,DEFAULT,STATICTEXT,DEFAULT,"Selected:"`
    BrowseDir05=`64,90,68,DEFAULT,VARYTEXT,DefDir,""`
    Button=Dialog("BrowseDir")

    if Button==1 then Directory=""
                 else Directory=StrLower(DirGet())

    IntControl(4,1,0,0,0)
    Return
