wx.ClipboardTextEvent

Inheritance diagram for wx.ClipboardTextEvent:



Description

This class represents the events generated by a control (typically a wx.TextCtrl but other windows can generate these events as well) when its content gets copied or cut to, or pasted from the clipboard. There are three types of corresponding events wx.wxEVT_COMMAND_TEXT_COPY, wx.wxEVT_COMMAND_TEXT_CUT and wx.wxEVT_COMMAND_TEXT_PASTE.

If any of these events is processed (without being skipped) by an event handler, the corresponding operation doesn’t take place which allows to prevent the text from being copied from or pasted to a control. It is also possible to examine the clipboard contents in the PASTE event handler and transform it in some way before inserting in a control – for example, changing its case or removing invalid characters.

Note

Finally notice that a CUT event is always preceded by the COPY event which makes it possible to only process the latter if it doesn’t matter if the text was copied or cut.

See also

wx.Clipboard

Remarks

These events are currently only generated by wx.TextCtrl under GTK. They are generated by all controls under Windows. (Prior to version 2.8.8, only wx.ComboBox and wx.TextCtrl without wx.TE_RICH style generated them under Windows.)

Event Handling

Event Name Description
wx.EVT_TEXT_COPY(id, func) Some or all of the controls content was copied to the clipboard.
wx.EVT_TEXT_CUT(id, func) Some or all of the controls content was cut (i.e. copied and deleted).
wx.EVT_TEXT_PASTE(id, func) Clipboard content was pasted into the control.

Methods Summary

Class API

Methods

__init__(type=wx.wxEVT_NULL, winid=0)

A Clipboard Text event is sent when a window intercepts a text copy/cut/paste message, i.e. the user has cut/copied/pasted data from/into a text control via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.

Parameters:

  • type (eventtype)
  • winid (int)

Returns:

wx.ClipboardTextEvent

Note

under windows these events are NOT generated automatically for a Rich Edit text control.