.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.richtext.RichTextEvent:

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextEvent**
==========================================================================================================================================

This is the event class for :ref:`wx.richtext.RichTextCtrl`  notifications.          







.. _RichTextEvent-events:

|events| Events Emitted by this Class
=====================================

Handlers bound for the following event types will receive a :ref:`wx.richtext.RichTextEvent` parameter.

Event macros: 

- EVT_RICHTEXT_LEFT_CLICK: Process a  ``wxEVT_RICHTEXT_LEFT_CLICK``   event, generated when the user releases the left mouse button over an object.   
- EVT_RICHTEXT_RIGHT_CLICK: Process a  ``wxEVT_RICHTEXT_RIGHT_CLICK``   event, generated when the user releases the right mouse button over an object.   
- EVT_RICHTEXT_MIDDLE_CLICK: Process a  ``wxEVT_RICHTEXT_MIDDLE_CLICK``   event, generated when the user releases the middle mouse button over an object.   
- EVT_RICHTEXT_LEFT_DCLICK: Process a  ``wxEVT_RICHTEXT_LEFT_DCLICK``   event, generated when the user double-clicks an object.   
- EVT_RICHTEXT_RETURN: Process a  ``wxEVT_RICHTEXT_RETURN``   event, generated when the user presses the return key. Valid event functions: GetFlags, GetPosition.   
- EVT_RICHTEXT_CHARACTER: Process a  ``wxEVT_RICHTEXT_CHARACTER``   event, generated when the user presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter.   
- EVT_RICHTEXT_CONSUMING_CHARACTER: Process a  ``wxEVT_RICHTEXT_CONSUMING_CHARACTER``   event, generated when the user presses a character key but before it is processed and inserted into the control. Call Veto to prevent normal processing. Valid event functions: GetFlags, GetPosition, GetCharacter, Veto.   
- EVT_RICHTEXT_DELETE: Process a  ``wxEVT_RICHTEXT_DELETE``   event, generated when the user presses the backspace or delete key. Valid event functions: GetFlags, GetPosition.   
- EVT_RICHTEXT_RETURN: Process a  ``wxEVT_RICHTEXT_RETURN``   event, generated when the user presses the return key. Valid event functions: GetFlags, GetPosition.   
- EVT_RICHTEXT_STYLE_CHANGED: Process a  ``wxEVT_RICHTEXT_STYLE_CHANGED``   event, generated when styling has been applied to the control. Valid event functions: GetPosition, GetRange.   
- EVT_RICHTEXT_STYLESHEET_CHANGED: Process a  ``wxEVT_RICHTEXT_STYLESHEET_CHANGING``   event, generated when the control's stylesheet has changed, for example the user added, edited or deleted a style. Valid event functions: GetRange, GetPosition.   
- EVT_RICHTEXT_STYLESHEET_REPLACING: Process a  ``wxEVT_RICHTEXT_STYLESHEET_REPLACING``   event, generated when the control's stylesheet is about to be replaced, for example when a file is loaded into the control. Valid event functions: Veto, GetOldStyleSheet, GetNewStyleSheet.   
- EVT_RICHTEXT_STYLESHEET_REPLACED: Process a  ``wxEVT_RICHTEXT_STYLESHEET_REPLACED``   event, generated when the control's stylesheet has been replaced, for example when a file is loaded into the control. Valid event functions: GetOldStyleSheet, GetNewStyleSheet.   
- EVT_RICHTEXT_PROPERTIES_CHANGED: Process a  ``wxEVT_RICHTEXT_PROPERTIES_CHANGED``   event, generated when properties have been applied to the control. Valid event functions: GetPosition, GetRange.   
- EVT_RICHTEXT_CONTENT_INSERTED: Process a  ``wxEVT_RICHTEXT_CONTENT_INSERTED``   event, generated when content has been inserted into the control. Valid event functions: GetPosition, GetRange.   
- EVT_RICHTEXT_CONTENT_DELETED: Process a  ``wxEVT_RICHTEXT_CONTENT_DELETED``   event, generated when content has been deleted from the control. Valid event functions: GetPosition, GetRange.   
- EVT_RICHTEXT_BUFFER_RESET: Process a  ``wxEVT_RICHTEXT_BUFFER_RESET``   event, generated when the buffer has been reset by deleting all content. You can use this to set a default style for the first new paragraph.   
- EVT_RICHTEXT_SELECTION_CHANGED: Process a  ``wxEVT_RICHTEXT_SELECTION_CHANGED``   event, generated when the selection range has changed.   
- EVT_RICHTEXT_FOCUS_OBJECT_CHANGED: Process a  ``wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED``   event, generated when the current focus object has changed.   










|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RichTextEvent</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.richtext.RichTextEvent_inheritance.png" alt="Inheritance diagram of RichTextEvent" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextEvent.html" title="wx.richtext.RichTextEvent" alt="" coords="5,315,196,344"/> <area shape="rect" id="node2" href="wx.NotifyEvent.html" title="wx.NotifyEvent" alt="" coords="39,237,162,267"/> <area shape="rect" id="node3" href="wx.CommandEvent.html" title="wx.CommandEvent" alt="" coords="26,160,175,189"/> <area shape="rect" id="node4" href="wx.Event.html" title="wx.Event" alt="" coords="59,83,142,112"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="57,5,144,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextEvent.__init__`                                      Constructor.
:meth:`~wx.richtext.RichTextEvent.Clone`                                         Returns a copy of the event.
:meth:`~wx.richtext.RichTextEvent.GetCharacter`                                  Returns the character pressed, within a  ``wxEVT_RICHTEXT_CHARACTER``   event.
:meth:`~wx.richtext.RichTextEvent.GetContainer`                                  Returns the container for which the event is relevant.
:meth:`~wx.richtext.RichTextEvent.GetFlags`                                      Returns flags indicating modifier keys pressed.
:meth:`~wx.richtext.RichTextEvent.GetNewStyleSheet`                              Returns the new style sheet.
:meth:`~wx.richtext.RichTextEvent.GetOldContainer`                               Returns the old container, for a focus change event.
:meth:`~wx.richtext.RichTextEvent.GetOldStyleSheet`                              Returns the old style sheet.
:meth:`~wx.richtext.RichTextEvent.GetPosition`                                   Returns the buffer position at which the event occurred.
:meth:`~wx.richtext.RichTextEvent.GetRange`                                      Gets the range for the current operation.
:meth:`~wx.richtext.RichTextEvent.SetCharacter`                                  Sets the character variable.
:meth:`~wx.richtext.RichTextEvent.SetContainer`                                  Sets the container for which the event is relevant.
:meth:`~wx.richtext.RichTextEvent.SetFlags`                                      Sets flags indicating modifier keys pressed.
:meth:`~wx.richtext.RichTextEvent.SetNewStyleSheet`                              Sets the new style sheet variable.
:meth:`~wx.richtext.RichTextEvent.SetOldContainer`                               Sets the old container, for a focus change event.
:meth:`~wx.richtext.RichTextEvent.SetOldStyleSheet`                              Sets the old style sheet variable.
:meth:`~wx.richtext.RichTextEvent.SetPosition`                                   Sets the buffer position variable.
:meth:`~wx.richtext.RichTextEvent.SetRange`                                      Sets the range variable.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextEvent.Character`                                     See :meth:`~wx.richtext.RichTextEvent.GetCharacter` and :meth:`~wx.richtext.RichTextEvent.SetCharacter`
:attr:`~wx.richtext.RichTextEvent.Container`                                     See :meth:`~wx.richtext.RichTextEvent.GetContainer` and :meth:`~wx.richtext.RichTextEvent.SetContainer`
:attr:`~wx.richtext.RichTextEvent.Flags`                                         See :meth:`~wx.richtext.RichTextEvent.GetFlags` and :meth:`~wx.richtext.RichTextEvent.SetFlags`
:attr:`~wx.richtext.RichTextEvent.NewStyleSheet`                                 See :meth:`~wx.richtext.RichTextEvent.GetNewStyleSheet` and :meth:`~wx.richtext.RichTextEvent.SetNewStyleSheet`
:attr:`~wx.richtext.RichTextEvent.OldContainer`                                  See :meth:`~wx.richtext.RichTextEvent.GetOldContainer` and :meth:`~wx.richtext.RichTextEvent.SetOldContainer`
:attr:`~wx.richtext.RichTextEvent.OldStyleSheet`                                 See :meth:`~wx.richtext.RichTextEvent.GetOldStyleSheet` and :meth:`~wx.richtext.RichTextEvent.SetOldStyleSheet`
:attr:`~wx.richtext.RichTextEvent.Position`                                      See :meth:`~wx.richtext.RichTextEvent.GetPosition` and :meth:`~wx.richtext.RichTextEvent.SetPosition`
:attr:`~wx.richtext.RichTextEvent.Range`                                         See :meth:`~wx.richtext.RichTextEvent.GetRange` and :meth:`~wx.richtext.RichTextEvent.SetRange`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.richtext.RichTextEvent(NotifyEvent)

   **Possible constructors**::

       RichTextEvent(commandType=wxEVT_NULL, winid=0)
       
       RichTextEvent(event)
       
   
   This is the event class for RichTextCtrl notifications.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, commandType=wxEVT_NULL, winid=0)`
      
      Constructor.                  
      
      
      
      
      :param `commandType`: The type of the event.   
      :type `commandType`: wx.EventType
      :param `winid`: Window identifier. The value  ``ID_ANY``   indicates a default value.    
      :type `winid`: int
      
      
      
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, event)`
      
      Copy constructor.                  
      
      
      :param `event`: 
      :type `event`: wx.richtext.RichTextEvent
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Clone(self)

      Returns a copy of the event.                  

      Any event that is posted to the wxWidgets event system for later action (via :meth:`wx.EvtHandler.AddPendingEvent` , :meth:`wx.EvtHandler.QueueEvent`   or :ref:`wx.PostEvent`) must implement this method. 

      All wxWidgets events fully implement this method, but any derived events implemented by the user should also implement this method just in case they (or some event derived from them) are ever posted. 

      All wxWidgets events implement a copy constructor, so the easiest way of implementing the Clone function is to implement a copy constructor for a new event (call it MyEvent) and then define the Clone function like this: 

      ::

          def Clone(self):

              return MyEvent()

                 

      :rtype: :ref:`Event`








   .. method:: GetCharacter(self)

      Returns the character pressed, within a  ``wxEVT_RICHTEXT_CHARACTER``   event.                   

      :rtype: :ref:`wx.Char`








   .. method:: GetContainer(self)

      Returns the container for which the event is relevant.                  

      :rtype: :ref:`wx.richtext.RichTextParagraphLayoutBox`








   .. method:: GetFlags(self)

      Returns flags indicating modifier keys pressed.                  

      Possible values are  ``RICHTEXT_CTRL_DOWN`` ,   ``RICHTEXT_SHIFT_DOWN`` , and   ``RICHTEXT_ALT_DOWN`` .                   

      :rtype: `int`








   .. method:: GetNewStyleSheet(self)

      Returns the new style sheet.                  

      Can be used in a  ``wxEVT_RICHTEXT_STYLESHEET_CHANGING``   or   ``wxEVT_RICHTEXT_STYLESHEET_CHANGED``   event handler.                   

      :rtype: :ref:`wx.richtext.RichTextStyleSheet`








   .. method:: GetOldContainer(self)

      Returns the old container, for a focus change event.                  

      :rtype: :ref:`wx.richtext.RichTextParagraphLayoutBox`








   .. method:: GetOldStyleSheet(self)

      Returns the old style sheet.                  

      Can be used in a  ``wxEVT_RICHTEXT_STYLESHEET_CHANGING``   or   ``wxEVT_RICHTEXT_STYLESHEET_CHANGED``   event handler.                   

      :rtype: :ref:`wx.richtext.RichTextStyleSheet`








   .. method:: GetPosition(self)

      Returns the buffer position at which the event occurred.                  

      :rtype: `long`








   .. method:: GetRange(self)

      Gets the range for the current operation.                  

      :rtype: :ref:`wx.richtext.RichTextRange`








   .. method:: SetCharacter(self, ch)

      Sets the character variable.                  


      :param `ch`: 
      :type `ch`: wx.Char







   .. method:: SetContainer(self, container)

      Sets the container for which the event is relevant.                  


      :param `container`: 
      :type `container`: wx.richtext.RichTextParagraphLayoutBox







   .. method:: SetFlags(self, flags)

      Sets flags indicating modifier keys pressed.                  

      Possible values are  ``RICHTEXT_CTRL_DOWN`` ,   ``RICHTEXT_SHIFT_DOWN`` , and   ``RICHTEXT_ALT_DOWN`` .                   


      :param `flags`: 
      :type `flags`: int







   .. method:: SetNewStyleSheet(self, sheet)

      Sets the new style sheet variable.                  


      :param `sheet`: 
      :type `sheet`: wx.richtext.RichTextStyleSheet







   .. method:: SetOldContainer(self, container)

      Sets the old container, for a focus change event.                  


      :param `container`: 
      :type `container`: wx.richtext.RichTextParagraphLayoutBox







   .. method:: SetOldStyleSheet(self, sheet)

      Sets the old style sheet variable.                  


      :param `sheet`: 
      :type `sheet`: wx.richtext.RichTextStyleSheet







   .. method:: SetPosition(self, pos)

      Sets the buffer position variable.                  


      :param `pos`: 
      :type `pos`: long







   .. method:: SetRange(self, range)

      Sets the range variable.                  


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange







   .. attribute:: Character

      See :meth:`~wx.richtext.RichTextEvent.GetCharacter` and :meth:`~wx.richtext.RichTextEvent.SetCharacter`


   .. attribute:: Container

      See :meth:`~wx.richtext.RichTextEvent.GetContainer` and :meth:`~wx.richtext.RichTextEvent.SetContainer`


   .. attribute:: Flags

      See :meth:`~wx.richtext.RichTextEvent.GetFlags` and :meth:`~wx.richtext.RichTextEvent.SetFlags`


   .. attribute:: NewStyleSheet

      See :meth:`~wx.richtext.RichTextEvent.GetNewStyleSheet` and :meth:`~wx.richtext.RichTextEvent.SetNewStyleSheet`


   .. attribute:: OldContainer

      See :meth:`~wx.richtext.RichTextEvent.GetOldContainer` and :meth:`~wx.richtext.RichTextEvent.SetOldContainer`


   .. attribute:: OldStyleSheet

      See :meth:`~wx.richtext.RichTextEvent.GetOldStyleSheet` and :meth:`~wx.richtext.RichTextEvent.SetOldStyleSheet`


   .. attribute:: Position

      See :meth:`~wx.richtext.RichTextEvent.GetPosition` and :meth:`~wx.richtext.RichTextEvent.SetPosition`


   .. attribute:: Range

      See :meth:`~wx.richtext.RichTextEvent.GetRange` and :meth:`~wx.richtext.RichTextEvent.SetRange`

