Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## cut-selection

Arguments: window-or-widget

Returns an object from the specified window or widget that is suitable for placing onto the clipboard, or `nil` if no suitable object is found. Also deletes the returned object from the window or widget when it knows how to do so. This function is called by cut-command, which does the actual placing of the object onto the clipboard. An application could call either function, or add methods to either in order to extend the clipboard functionality.

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

If a cut was done, then a second value is also returned to indicate the suitable clipboard format, as described under copy-selection.

The default method just calls copy-selection, and so does not delete the copied object. The methods for `editable-text-pane` and `text-edit-pane` return and delete the selected text, if any. The method for `rich-edit-pane` returns a rich text string for the selected text if any, and deletes the text. The method for `combo-box` returns and deletes the selected text if its typable property is true, and otherwise does nothing and returns `nil`.

The methods for `single-item-list-pane` and `multi-item-list-pane` will return the selected item or items and also delete them from the range of the associated `dialog-item`. The method for `dialog-item` simply calls cut-selection on the window of the `dialog-item` if the widget is currently on a parent window. See copy-selection for a note abouting adding additional methods for other types of widgets.

An around method on `widget-window` causes nothing to be done if window-or-widget is either a `dialog-item` or its associated window, and the widget's cuttable property is `nil`. By default, CUTTABLE is true only for text-editing widgets.

An anomaly: When called on a `rich-edit-pane` in Windows, it is cut-selection rather than cut-command that actually places the object onto the clipboard. This is due to a problem with mapping the Common Graphics behavior onto the Windows clipboard and rich-edit APIs. In this case, both the rich text string and the plain text string are placed onto the clipboard, with the rich text string being topmost on the lisp clipboard stack.

### Compatibility notes

In releases prior to 7.0, this function passed its action to the lowest selected descendent child window of the specified window, though some applications may not desire such automatic redirection. The functions focus-component, get-focus, or selected-window may be useful for finding a suitable widget or window to pass to this function. Earlier releases also returned the window where the copy was actually done as the first value, and the copied object as the second value.

See cg-clipboard.htm.

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.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version