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

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 an instance of the basic-pane, dialog-item or screen class or one of their subclasses.

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-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version