.. 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

.. currentmodule:: wx.lib.expando

.. highlight:: python



.. _wx.lib.expando.ExpandoTextCtrl:

==========================================================================================================================================
|phoenix_title|  **wx.lib.expando.ExpandoTextCtrl**
==========================================================================================================================================

The ExpandoTextCtrl is a multi-line wx.TextCtrl that will
adjust its height on the fly as needed to accommodate the number of
lines needed to display the current content of the control.  It is
assumed that the width of the control will be a fixed value and
that only the height will be adjusted automatically.  If the
control is used in a sizer then the width should be set as part of
the initial or min size of the control.

When the control resizes itself it will attempt to also make
necessary adjustments in the sizer hierarchy it is a member of (if
any) but if that is not suffiecient then the programmer can catch
the EVT_ETC_LAYOUT_NEEDED event in the container and make any
other layout adjustments that may be needed.



|

|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>ExpandoTextCtrl</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.lib.expando.ExpandoTextCtrl_inheritance.png" alt="Inheritance diagram of ExpandoTextCtrl" 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.lib.expando.ExpandoTextCtrl.html" title="wx.lib.expando.ExpandoTextCtrl" alt="" coords="55,469,285,499"/> <area shape="rect" id="node2" href="wx.TextCtrl.html" title="wx.TextCtrl" alt="" coords="123,392,217,421"/> <area shape="rect" id="node3" href="wx.Control.html" title="wx.Control" alt="" coords="63,315,155,344"/> <area shape="rect" id="node4" href="wx.TextEntry.html" title="wx.TextEntry" alt="" coords="179,315,286,344"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="60,237,157,267"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="44,160,173,189"/> <area shape="rect" id="node7" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="50,83,167,112"/> <area shape="rect" id="node8" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> <area shape="rect" id="node9" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="117,5,223,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.agw.aui.auibook.TabTextCtrl`, :class:`wx.lib.agw.customtreectrl.TreeTextCtrl`, :class:`wx.lib.agw.ultimatelistctrl.UltimateListTextCtrl`

|


|super_classes| Known Superclasses
==================================

:class:`wx.TextCtrl`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.expando.ExpandoTextCtrl.__init__`                                 Default class constructor.
:meth:`~wx.lib.expando.ExpandoTextCtrl.AppendText`                               Appends the text to the end of the text control.
:meth:`~wx.lib.expando.ExpandoTextCtrl.GetMaxHeight`                             Returns the maximum height that the control will expand to on its own.
:meth:`~wx.lib.expando.ExpandoTextCtrl.GetNumberOfLines`                         GetNumberOfLines() -> int
:meth:`~wx.lib.expando.ExpandoTextCtrl.OnSize`                                   Handles the ``wx.EVT_SIZE`` event for :class:`ExpandoTextCtrl`.
:meth:`~wx.lib.expando.ExpandoTextCtrl.OnTextChanged`                            Handles the ``wx.EVT_TEXT`` event for :class:`ExpandoTextCtrl`.
:meth:`~wx.lib.expando.ExpandoTextCtrl.SetFont`                                  Sets the font for the :class:`ExpandoTextCtrl`.
:meth:`~wx.lib.expando.ExpandoTextCtrl.SetMaxHeight`                             Sets the maximum height that the control will expand to on its
:meth:`~wx.lib.expando.ExpandoTextCtrl.WriteText`                                Writes the text into the text control at the current insertion position.
================================================================================ ================================================================================


|


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


.. class:: ExpandoTextCtrl(wx.TextCtrl)

   The ExpandoTextCtrl is a multi-line wx.TextCtrl that will
   adjust its height on the fly as needed to accommodate the number of
   lines needed to display the current content of the control.  It is
   assumed that the width of the control will be a fixed value and
   that only the height will be adjusted automatically.  If the
   control is used in a sizer then the width should be set as part of
   the initial or min size of the control.
   
   When the control resizes itself it will attempt to also make
   necessary adjustments in the sizer hierarchy it is a member of (if
   any) but if that is not suffiecient then the programmer can catch
   the EVT_ETC_LAYOUT_NEEDED event in the container and make any
   other layout adjustments that may be needed.

   .. method:: __init__(self, parent, id=-1, value="", pos=wx.DefaultPosition,  size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name="expando")

      Default class constructor.
      
      :param `parent`: parent window, must not be ``None``;
      :param integer `id`: window identifier. A value of -1 indicates a default value;
      :param string `value`: the control text label;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param integer `style`: the underlying :class:`wx.Control` style;
      :param wx.Validator `validator`: the window validator;
      :param string `name`: the widget name.
      
      :type parent: :class:`wx.Window`
      :type pos: tuple or :class:`wx.Point`
      :type size: tuple or :class:`wx.Size`


   .. method:: AppendText(self, text)

      Appends the text to the end of the text control.
      
      :param string `text`: text to write to the text control.
      
      .. seealso:: :meth:`WriteText`


   .. method:: GetMaxHeight(self)

      Returns the maximum height that the control will expand to on its own.
      
      :rtype: int


   .. method:: GetNumberOfLines(self)

      GetNumberOfLines() -> int
      
      Returns the number of lines in the text control buffer.


   .. method:: OnSize(self, evt)

      Handles the ``wx.EVT_SIZE`` event for :class:`ExpandoTextCtrl`.
      
      :param `event`: a :class:`wx.SizeEvent` event to be processed.


   .. method:: OnTextChanged(self, evt)

      Handles the ``wx.EVT_TEXT`` event for :class:`ExpandoTextCtrl`.
      
      :param `event`: a :class:`CommandEvent` event to be processed.


   .. method:: SetFont(self, font)

      Sets the font for the :class:`ExpandoTextCtrl`.
      
      :param wx.Font font: font to associate with the :class:`ExpandoTextCtrl`, pass
       ``NullFont`` to reset to the default font.
      
      :rtype: bool
      :returns: ``True`` if the font was really changed, ``False`` if it was already
       set to this font and nothing was done.


   .. method:: SetMaxHeight(self, h)

      Sets the maximum height that the control will expand to on its
      own, and adjusts it down if needed.
      
      :param integer `h`: the maximum control height, in pixels.


   .. method:: WriteText(self, text)

      Writes the text into the text control at the current insertion position.
      
      :param string `text`: text to write to the text control.
      
      .. note::
      
         Newlines in the text string are the only control characters allowed, and they
         will cause appropriate line breaks. See :meth:`AppendText` for more convenient
         ways of writing to the window. After the write operation, the insertion point
         will be at the end of the inserted text, so subsequent write operations will
         be appended. To append text after the user may have interacted with the control,
         call :meth:`TextCtrl.SetInsertionPointEnd` before writing.


