.. wxPython Phoenix documentation

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

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

.. include:: headings.inc



.. _wx.dataview.DataViewValueAdjuster:

==========================================================================================================================================
|phoenix_title|  **wx.dataview.DataViewValueAdjuster**
==========================================================================================================================================

This class can be used with :meth:`wx.dataview.DataViewRenderer.SetValueAdjuster`   to customize rendering of model values with standard renderers. 
         

Can be used to change the value if it is shown on a highlighted row (i.e. in selection) which typically has dark background. It is useful in combination with :ref:`wx.dataview.DataViewTextRenderer`  with markup and can be used e.g. to remove background color attributes inside selection, as a lightweight alternative to implementing an entire :ref:`wx.dataview.DataViewCustomRenderer`  specialization. 

::

    # Markup renderer that removes bgcolor attributes when in selection
    class DataViewMarkupRenderer(wx.dataview.DataViewTextRenderer):

        def __init__(self):
            super(DataViewMarkupRenderer, self).__init__()
            self.EnableMarkup()
            self.SetValueAdjuster(DataViewMarkupRenderer._Adjuster())

        class _Adjuster(wx.dataview.DataViewValueAdjuster):
            def MakeHighlighted(self, value):
                pos = value.find(" bgcolor=\"")
                if pos != -1:
                    pos2 = s.find('"', pos + 10)
                    value = value[:pos] + value[pos2+1:]
                return value











.. versionadded:: 4.1/wxWidgets-3.1.1  
    







|

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

.. raw:: html

   <div class="collabsible-wrapper">
      <input id="collapsible-inheritance" class="collapsible-checkbox" type="checkbox">
      <label for="collapsible-inheritance" tabindex="0" title="Show inheritance diagram" class="collapsible-label">Inheritance diagram for class <strong>DataViewValueAdjuster</strong>:</label>
      <div class="collapsible-content">
         <p class="graphviz">
            <center><img src="_static/images/inheritance/wx.dataview.DataViewValueAdjuster_inheritance.svg" alt="Inheritance diagram of DataViewValueAdjuster" usemap="#dummy" class="inheritance invert-in-dark-mode"/></center>
            <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.dataview.DataViewValueAdjuster.html" title="This class can be used with wx.dataview.DataViewRenderer.SetValueAdjuster   to customize rendering of model values with standard renderers." alt="" coords="5,5,293,34"/> </map> 
         </p>
      </div>
   </div>
   <script type="text/javascript" src="_static/inheritancetoggle.js"></script>



|


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

================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewValueAdjuster.MakeHighlighted`                       Change value for rendering when highlighted.
================================================================================ ================================================================================


|


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


.. class:: wx.dataview.DataViewValueAdjuster(object)

   This class can be used with `DataViewRenderer.SetValueAdjuster()` to
   customize rendering of model values with standard renderers.



   .. method:: MakeHighlighted(self, value)

      Change value for rendering when highlighted. 
                 

      Override to customize the value when it is shown in a highlighted (selected) row, typically on a dark background. 

      Default implementation returns `value`  unmodified. 

      The `value`  passed to this method is always non-null and it must return a non-null value too. 
                 


      :param `value`: 
      :type `value`: DVCVariant




      :rtype: `DVCVariant`     







