Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 7.0
Object described on page has changed in 7.0.

paste-command

Arguments: window-or-widget

Retrieves an object from the clipboard and pastes it into the specified window or widget. Returns the object that was pasted and its clipboard format.

This is largely a convenience function that combines other exported functionality as it is typically used. An application menu command could call this function directly.

window-or-widget should be an instance of a basic-pane subclass or a dialog-item subclass.

The default paste-command and insert-command methods are shown below, in case you need to use some variation of this typical behavior. These methods first pass the action down to the bottommost selected-window of the window that was passed in, and call default-clipboard-format to find what type of object is typically pasted into this type of window. They then call top-clipboard-value-of-type to retrieve a value of that type from the clipboard, and finally call paste-selection or insert-selection to paste that object into the specified window or widget.

(defmethod paste-command ((stream cg-stream))
  (let* ((child (selected-window stream)))
    (if* child
       then (paste-command child)
       else (paste-or-insert-command stream nil))))

(defmethod insert-command ((stream cg-stream))
  (let* ((child (selected-window stream)))
    (if* child
       then (insert-command child)
       else (paste-or-insert-command stream t))))

(defun paste-or-insert-command (stream insert?)
  (setq stream (or (dialog-item stream) stream))
  (let* ((format (default-clipboard-format stream))
         (object (with-object-locale (stream)
                   (top-clipboard-value-of-type format))))
    (and object
         (if insert?
             (insert-selection stream object)
           (paste-selection stream object)))))

There are also methods on dialog-item that simply pass the action to the widget's window when the widget is on a parent window.

See copy-command for discussion of the calls to dialog-item and with-object-locale in this code.

See cg-clipboard.htm.


Copyright (c) 1998-2006, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 7.0. The object described on this page has been modified in the 7.0 release; see the Release Notes.
Created 2005.9.20.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 7.0
Object described on page has changed in 7.0.