| Allegro CL version 8.2 Unrevised from 8.1 to 8.2. 8.1 version |
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-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.
| Allegro CL version 8.2 Unrevised from 8.1 to 8.2. 8.1 version |