beetlebug▾
/

selection clear

Removes the owner of a selection.

selection clear ?-displayof WINDOW? ?-selection NAME?

Description

The selection has no owner after the command. When the owner set -command with selection own, its script runs at the global level. A selection with no owner stays as it is.

Options

OptionTypeDefaultDescription
-displayofwindownoneA window of the display of the selection.
-selectionstringPRIMARYThe name of the selection to clear.

-displayof WINDOW

A window of the display of the selection.

ztk has one display for each app, so the value has no effect. ztk does not check that WINDOW exists.

% selection clear -displayof .

ztk accepts any value of -displayof.

-selection NAME

The name of the selection to clear.

The owners of the other selections stay.

% frame .k2
> selection own .k2
> selection own -selection CLIPBOARD .k2
> selection clear -selection CLIPBOARD
> list [selection own] [selection own -selection CLIPBOARD]
.k2 {}

Any name is a selection.

Returns

An empty string.

Examples

% frame .k
> set gone 0
> selection own -command {set gone 1} .k
> selection clear
> list [selection own] $gone
{} 1

Errors

% selection clear -foo 1
bad option "-foo": must be -displayof, or -selection
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also