| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |
Arguments: window
This function is used by the File | Save menu-item of the default menu-bar that may be interactively attached to a form. In the IDE, it demonstrates a typical "Save" command for saving a text file but this function is not available in a runtime image. A custom application that implements a "Save" command will need to supply its own code for such a command instead, but it may be useful to model after the default menu-bar's example. So here is the code for the save-text-file example (note that this code changed between the 6.2 and 7.0 releases):
(in-package :cg) (defmethod save-text-file ((window basic-pane)) ;; Called by the default "Save" menu-item added to a form. (let* ((selected-window (selected-window window))) (when selected-window (save-text-file-2 selected-window (file selected-window))))) (defmethod save-text-file-2 ((window basic-pane) &optional pathname old-pathname) (declare (ignore pathname old-pathname)) (warn "The selected window does not know how to do a save.")) (defmethod save-text-file-2 ((window text-edit-window) &optional pathname old-pathname) (unless pathname (setq pathname (ask-user-for-new-pathname "Specify the new directory and filename." :stream window :initial-directory (and old-pathname (path-namestring old-pathname)) :initial-name (and old-pathname (file-namestring old-pathname))))) (when pathname (let* ((text-edit-pane (frame-child window))) (save-file text-edit-pane pathname) (setf (file text-edit-pane) pathname) (setf (title window)(namestring pathname)))))
See also new-text-editor, open-text-file, and save-as-text-file.
Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |