Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version


Arguments: window

This function is used by the File | Save As menu-item of the default menu-bar that may be interactively attached to a form. In the IDE, it demonstrates a typical "Save As" command for saving a text file but this function is not available in a runtime image. A custom application that implements a "Save As" 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. Here is the code for the save-as-text-file example (note: this code changed between release 6.2 and release 7.0):

(in-package :cg)
(defmethod save-as-text-file ((window basic-pane))
  ;; Called by the default "Save As" menu-item added to a form.
  (let* ((selected-window (selected-window window)))
    (when selected-window
       selected-window nil (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
                    (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-text-file.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version