Re: file dialogs
Frederic Udina <[email protected]> Fri, 7 Jun 2002 09:22:30 +0200 (MET DST)
| Newsgroups | gmane.lisp.statistics |
|---|---|
| Message-ID | <[email protected]> |
Forrest, I guess that the file-dialogs were written mostly for its use from the menus in the mac version, so they were not documented. The windows versio= n are clearly more useful that documented. In unix, the functions aren't defined. Now I use a common interface for using the windows one's and a modification of some functions that bernhardt walter wrote in the dark years. best regards, On Fri, 7 Jun 2002, Forrest Young wrote: ~~~Frederic: ~~~ ~~~What you found out about file-dialogs will be very useful for ViSta. ~~~Thanks for letting me know. ~~~ ~~~I have taken your information and written the following dialog (it see= ms ~~~to be the case that (set-file-dialog) does not have the same arguments ~~~under windows as described in Luke's book in the addendum about how it ~~~works for the Mac, the only description I know of.=A0 How does it work= for ~~~Unix? ~~~ ~~~Forrest ~~~=A0 ~~~ ~~~(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 unde= r ~~~ms-windows. ~~~The dialog will be an OPEN dialog by default. ~~~It will be a SAVE dialog when TITLE is non-nil. ~~~=A0 ~~~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 num= ber ~~~of description|mask pairs, with pairs separated by |. Default is: ~~~=A0=A0=A0=A0 \"All Files(*.*)|*.*|Lisp Files(*.LSP)|*.lsp|ViSta Applet ~~~Files(*.VAF)|*.vaf|ViSta Data Files(*.VDF)|*.vdf|Visualization ~~~Files(*.VIS)|*.vis|Text Files(*.TXT)|*.txt\" " ~~~ ~~~=A0 (unless filters (setf filters "All Files(*.*)|*.*|Lisp ~~~Files(*.LSP)|*.lsp|ViSta Applet Files(*.VAF)|*.vaf|ViSta Data ~~~Files(*.VDF)|*.vdf|Text Files(*.TXT)|*.txt")) ~~~ ~~~=A0 #+msdos(if title ~~~=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (set-file-dialog title change-dir= ectory filters) ~~~=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (open-file-dialog change-director= y filters))) ~~~=A0 ~~~ ~~~Forrest, ~~~ ~~~=A0I want to send you something I learned some ~~~weeks ago. Under XLS-Windows, open-file-dialog aand set-file-dialog ha= ve ~~~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 direct= ory ~~~being changed on exiting the call ~~~FILTER is a string of the form ~~~=A0=A0=A0=A0 "Text files (*.txt)|*.txt|All files (*.*)|*.*" ~~~=A0=A0=A0=A0 default being "Lisp Files(*.LSP)|*.lsp|All Files(*.*)|*.*= " ~~~=A0=A0=A0=A0 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 m= any ~~~different extensions... ~~~ ~~~=A0Frederic Udina ~~~=A0 __________________________________________________________________= __ ~~~=A0 <[email protected]> Dept. D'Economia i Empresa=A0=A0 Universitat Pompeu= Fabra ~~~=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Ramon Trias Fargas= , 25-27=A0=A0=A0=A0=A0 08005 Barcelona SPAIN ~~~=A0 tel. 34- 935421756/1763 fax: 34- 935421746=A0=A0=A0=A0 http://libi= ya.upf.es/ ~~~=A0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~ ~~~=A0 There are many here among us who feel that life is but a joke=A0 B= .Dy. ~~~=A0 ~~~=A0 ~~~=A0 ~~~ 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.