file dialog

Forrest Young <[email protected]> Fri, 07 Jun 2002 03:04:00 -0400
Newsgroups gmane.lisp.statistics
Organization ViSualStats
Message-ID <[email protected]>
Frederic:  

This will be very useful for ViSta, and I have taken your information
and written the following dialog:


(defun file-dialog (&optional (title nil) change-directory filters)
"Args: &optional filename change-directory (title \"Save\") filters
Presents a file dialog for opening (the default) or saving a file under
ms-windows. 
The dialog will be an OPEN dialog by default. 
It will be a SAVE dialog when TITLE is non-nil.
  
TITLE
is a title string for the SAVE dialog. The title of the open dialog is
OPEN, regardless.

CHANGE-DIRECTORY 
is t/nil for whether you want the current directory to change to the
file's directory after the dialog is closed (does not change if
canceled).

FILTERS
is a string of the form \"Text files (*.txt)|*.txt\" accepting any
number of description|mask pairs, with pairs separated by |. Default is:
     \"All Files(*.*)|*.*|Lisp Files(*.LSP)|*.lsp|ViSta Applet
Files(*.VAF)|*.vaf|ViSta Data Files(*.VDF)|*.vdf|Visualization
Files(*.VIS)|*.vis|Text Files(*.TXT)|*.txt\" "

  (unless filters (setf filters "All Files(*.*)|*.*|Lisp
Files(*.LSP)|*.lsp|ViSta Applet Files(*.VAF)|*.vaf|ViSta Data
Files(*.VDF)|*.vdf|Text Files(*.TXT)|*.txt"))

  #+msdos(if title 
             (set-file-dialog title change-directory filters)
             (open-file-dialog change-directory filters)))

-------- Original Message --------
From: Frederic Udina <[email protected]>
Subject: Re: Convergence on ViSta 7
To: Forrest Young <[email protected]>


Forrest,

good noews, yes. I don't have the time to sort out what are the files
where I could contribute. But I want to send you something I learned
some
weeks ago. Under XLS-Windows, ope-file-dialog aand set-file-dialog have
more arguments than aparent.

So, properly it is:

(defun open-file-dialog (&optional change-dir filter)
...)

(defun set-file-dialog (title &optional change-dir filter)
...)

where
TITLE is a title string for the dialog
CHANGE-DIR is t/nil meaning wehter you want the current working
directory
being changed on exiting the call
FILTER is a string of the form 
     "Text files (*.txt)|*.txt|All files (*.*)|*.*"
     default being "Lisp Files(*.LSP)|*.lsp|All Files(*.*)|*.*"
     and accepting nay number of pairs description|mask

For example, try
(open-file-dialog nil "Vista data files (*.vdf)|*.vdf|All
Files(*.*)|*.*")

Did you know that? It should be usefull to ViSta given that you have
many
different extensions...

 Frederic Udina
  ____________________________________________________________________
  <[email protected]> Dept. D'Economia i Empresa   Universitat Pompeu Fabra
                  Ramon Trias Fargas, 25-27      08005 Barcelona SPAIN
  tel. 34- 935421756/1763 fax: 34- 935421746     http://libiya.upf.es/
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  There are many here among us who feel that life is but a joke  B.Dy.