.. 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.propgrid.EditEnumProperty:
==========================================================================================================================================
|phoenix_title| **wx.propgrid.EditEnumProperty**
==========================================================================================================================================
:ref:`wx.propgrid.EnumProperty` with `String` value and writable combo box editor.
.. note::
Uses int value, similar to :ref:`wx.propgrid.EnumProperty`, unless text entered by user is not in choices (in which case string value is used).
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.propgrid.EditEnumProperty.__init__`
:meth:`~wx.propgrid.EditEnumProperty.OnSetValue` This virtual function is called after m_value has been set.
:meth:`~wx.propgrid.EditEnumProperty.StringToValue` Converts text into `Variant` value appropriate for this property.
:meth:`~wx.propgrid.EditEnumProperty.ValidateValue` Implement this function in derived class to check the value.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.propgrid.EditEnumProperty(EnumProperty)
**Possible constructors**::
EditEnumProperty(label=PG_LABEL, name=PG_LABEL, labels=[], values=[],
value="") -> None
EditEnumProperty(label, name, choices, value="") -> None
EnumProperty with string value and writable combo box editor.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, label=PG_LABEL, name=PG_LABEL, labels=[], values=[], value="")`
:param `label`:
:type `label`: string
:param `name`:
:type `name`: string
:param `labels`:
:type `labels`: list of strings
:param `values`:
:type `values`: list of integers
:param `value`:
:type `value`: string
:rtype: `None`
:html:`
`
**__init__** `(self, label, name, choices, value="")`
:param `label`:
:type `label`: string
:param `name`:
:type `name`: string
:param `choices`:
:type `choices`: wx.propgrid.PGChoices
:param `value`:
:type `value`: string
:rtype: `None`
:html:`
`
.. method:: OnSetValue(self)
This virtual function is called after m_value has been set.
:rtype: `None`
.. note::
- If m_value was set to Null variant (i.e. unspecified value), :meth:`OnSetValue` will not be called.
- m_value may be of any variant type. Typically properties internally support only one variant type, and as such :meth:`OnSetValue` provides a good opportunity to convert supported values into internal type.
- Default implementation does nothing.
.. method:: StringToValue(self, text, flags=PGPropValFormatFlags.Null)
Converts text into `Variant` value appropriate for this property.
:param `text`: Text to be translated into variant.
:type `text`: string
:param `flags`: If :meth:`wx.propgrid.PGPropValFormatFlags.FullValue` is set, returns complete, storable value instead of displayable one (they may be different). If :meth:`wx.propgrid.PGPropValFormatFlags.CompositeFragment` is set, text is interpreted as a part of composite property string value (as generated by :meth:`~wx.propgrid.EnumProperty.ValueToString` called with this same flag).
:type `flags`: wx.propgrid.PGPropValFormatFlags
:rtype: :ref:`Tuple[bool, PGVariant]`
You might want to take into account that m_value is Null variant if property value is unspecified (which is usually only case if you explicitly enabled that sort behaviour).
:returns:
Returns ``True`` if resulting `Variant` value was different.
.. note::
Default implementation converts semicolon delimited tokens into child values. Only works for properties with children.
.. method:: ValidateValue(self, value, validationInfo)
Implement this function in derived class to check the value.
Return ``True`` if it is ok. Returning ``False`` prevents property change events from occurring.
:param `value`:
:type `value`: PGVariant
:param `validationInfo`:
:type `validationInfo`: wx.propgrid.PGValidationInfo
:rtype: `bool`
.. note::
- Default implementation always returns ``True``.