.. 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.propgrid.PropertyGridEvent:
==========================================================================================================================================
|phoenix_title| **wx.propgrid.PropertyGridEvent**
==========================================================================================================================================
A property grid event holds information about events associated with :ref:`wx.propgrid.PropertyGrid` objects.
To process input from a property grid control, use these event handler macros to direct input to member functions that take a :ref:`wx.propgrid.PropertyGridEvent` argument.
.. _PropertyGridEvent-events:
|events| Events Emitted by this Class
=====================================
Handlers bound for the following event types will receive a :ref:`wx.propgrid.PropertyGridEvent` parameter.
- ``EVT_PG_SELECTED`` : Respond to ``wxEVT_PG_SELECTED`` event, generated when a property selection has been changed, either by user action or by indirect program function. For instance, collapsing a parent property programmatically causes any selected child property to become unselected, and may therefore cause this event to be generated.
- EVT_PG_CHANGED: Respond to ``wxEVT_PG_CHANGED`` event, generated when property value has been changed by the user.
- EVT_PG_CHANGING: Respond to ``wxEVT_PG_CHANGING`` event, generated when property value is about to be changed by user. Use :meth:`wx.propgrid.PropertyGridEvent.GetValue` to take a peek at the pending value, and :meth:`wx.propgrid.PropertyGridEvent.Veto` to prevent change from taking place, if necessary.
- EVT_PG_HIGHLIGHTED: Respond to ``wxEVT_PG_HIGHLIGHTED`` event, which occurs when mouse moves over a property. Event's property is ``None`` if hovered area does not belong to any property.
- EVT_PG_RIGHT_CLICK: Respond to ``wxEVT_PG_RIGHT_CLICK`` event, which occurs when property is clicked on with right mouse button.
- EVT_PG_DOUBLE_CLICK: Respond to ``wxEVT_PG_DOUBLE_CLICK`` event, which occurs when property is double-clicked on with left mouse button.
- EVT_PG_ITEM_COLLAPSED: Respond to ``wxEVT_PG_ITEM_COLLAPSED`` event, generated when user collapses a property or category.
- EVT_PG_ITEM_EXPANDED: Respond to ``wxEVT_PG_ITEM_EXPANDED`` event, generated when user expands a property or category.
- EVT_PG_LABEL_EDIT_BEGIN: Respond to ``wxEVT_PG_LABEL_EDIT_BEGIN`` event, generated when user is about to begin editing a property label. You can veto this event to prevent the action.
- EVT_PG_LABEL_EDIT_ENDING: Respond to ``wxEVT_PG_LABEL_EDIT_ENDING`` event, generated when user is about to end editing of a property label. You can veto this event to prevent the action.
- EVT_PG_COL_BEGIN_DRAG: Respond to ``wxEVT_PG_COL_BEGIN_DRAG`` event, generated when user starts resizing a column - can be vetoed.
- ``EVT_PG_COL_DRAGGING``, : Respond to ``wxEVT_PG_COL_DRAGGING`` , event, generated when a column resize by user is in progress. This event is also generated when user double-clicks the splitter in order to recenter it.
- EVT_PG_COL_END_DRAG: Respond to ``wxEVT_PG_COL_END_DRAG`` event, generated after column resize by user has finished.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
PropertyGridEvent:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.propgrid.PropertyGridEvent.__init__` Constructor.
:meth:`~wx.propgrid.PropertyGridEvent.CanVeto` Returns ``True`` if you can veto the action that the event is signaling.
:meth:`~wx.propgrid.PropertyGridEvent.GetColumn` Returns the column index associated with this event.
:meth:`~wx.propgrid.PropertyGridEvent.GetMainParent` Returns highest level non-category, non-root parent of property for which event occurred.
:meth:`~wx.propgrid.PropertyGridEvent.GetProperty` Returns property associated with this event.
:meth:`~wx.propgrid.PropertyGridEvent.GetPropertyName` Returns name of the associated property.
:meth:`~wx.propgrid.PropertyGridEvent.GetPropertyValue` Returns value of the associated property.
:meth:`~wx.propgrid.PropertyGridEvent.GetValidationFailureBehavior` Returns current validation failure flags.
:meth:`~wx.propgrid.PropertyGridEvent.GetValue` Returns value of the associated property.
:meth:`~wx.propgrid.PropertyGridEvent.SetCanVeto` Set if event can be vetoed.
:meth:`~wx.propgrid.PropertyGridEvent.SetProperty` Changes the property associated with this event.
:meth:`~wx.propgrid.PropertyGridEvent.SetValidationFailureBehavior` Set override validation failure behaviour.
:meth:`~wx.propgrid.PropertyGridEvent.SetValidationFailureMessage` Sets custom failure message for this time only.
:meth:`~wx.propgrid.PropertyGridEvent.Veto` Call this from your event handler to veto action that the event is signaling.
:meth:`~wx.propgrid.PropertyGridEvent.WasVetoed` Returns ``True`` if event was vetoed.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.propgrid.PropertyGridEvent.Column` See :meth:`~wx.propgrid.PropertyGridEvent.GetColumn`
:attr:`~wx.propgrid.PropertyGridEvent.MainParent` See :meth:`~wx.propgrid.PropertyGridEvent.GetMainParent`
:attr:`~wx.propgrid.PropertyGridEvent.Property` See :meth:`~wx.propgrid.PropertyGridEvent.GetProperty` and :meth:`~wx.propgrid.PropertyGridEvent.SetProperty`
:attr:`~wx.propgrid.PropertyGridEvent.PropertyName` See :meth:`~wx.propgrid.PropertyGridEvent.GetPropertyName`
:attr:`~wx.propgrid.PropertyGridEvent.PropertyValue` See :meth:`~wx.propgrid.PropertyGridEvent.GetPropertyValue`
:attr:`~wx.propgrid.PropertyGridEvent.ValidationFailureBehavior` See :meth:`~wx.propgrid.PropertyGridEvent.GetValidationFailureBehavior` and :meth:`~wx.propgrid.PropertyGridEvent.SetValidationFailureBehavior`
:attr:`~wx.propgrid.PropertyGridEvent.Value` See :meth:`~wx.propgrid.PropertyGridEvent.GetValue`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.propgrid.PropertyGridEvent(CommandEvent)
**Possible constructors**::
PropertyGridEvent(commandType: EventType=0, id: int=0) -> None
PropertyGridEvent(event : PropertyGridEvent) -> None
A property grid event holds information about events associated with
PropertyGrid objects.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, commandType: EventType=0, id: int=0)`
Constructor.
:param `commandType`:
:type `commandType`: wx.EventType
:param `id`:
:type `id`: int
:rtype: `None`
:html:`
`
**__init__** `(self, event : PropertyGridEvent)`
Copy constructor.
:param `event`:
:type `event`: wx.propgrid.PropertyGridEvent
:rtype: `None`
:html:`
`
.. method:: CanVeto(self)
Returns ``True`` if you can veto the action that the event is signaling.
:rtype: `bool`
.. method:: GetColumn(self)
Returns the column index associated with this event.
For the column dragging events, it is the column to the left of the splitter being dragged
:rtype: `int`
.. method:: GetMainParent(self)
Returns highest level non-category, non-root parent of property for which event occurred.
Useful when you have nested properties with children.
:rtype: :ref:`wx.propgrid.PGProperty`
.. note::
If immediate parent is root or category, this will return the property itself.
.. method:: GetProperty(self)
Returns property associated with this event.
:rtype: :ref:`wx.propgrid.PGProperty`
.. note::
You should assume that this property can always be ``None``. For instance, ``wxEVT_PG_SELECTED`` is emitted not only when a new property is selected, but also when selection is cleared by user activity.
.. method:: GetPropertyName(self)
Returns name of the associated property.
:rtype: `str`
.. note::
Property name is stored in event, so it remains accessible even after the associated property or the property grid has been deleted.
.. method:: GetPropertyValue(self)
Returns value of the associated property.
Works for all event types, but for ``wxEVT_PG_CHANGING`` this member function returns the value that is pending, so you can call :meth:`Veto` if the value is not satisfactory.
:rtype: `PGVariant`
.. note::
Property value is stored in event, so it remains accessible even after the associated property or the property grid has been deleted.
.. method:: GetValidationFailureBehavior(self)
Returns current validation failure flags.
:rtype: `int`
.. method:: GetValue(self)
Returns value of the associated property.
:rtype: `PGVariant`
.. seealso:: :meth:`GetPropertyValue`
.. method:: SetCanVeto(self, canVeto : bool)
Set if event can be vetoed.
:param `canVeto`:
:type `canVeto`: bool
:rtype: `None`
.. method:: SetProperty(self, p : PGProperty)
Changes the property associated with this event.
:param `p`:
:type `p`: wx.propgrid.PGProperty
:rtype: `None`
.. method:: SetValidationFailureBehavior(self, flags : int)
Set override validation failure behaviour.
Only effective if :meth:`Veto` was also called, and only allowed if event type is ``wxEVT_PG_CHANGING`` .
:param `flags`:
:type `flags`: wx.byte
:rtype: `None`
.. method:: SetValidationFailureMessage(self, message : str)
Sets custom failure message for this time only.
Only applies if ``PG_VFB_SHOW_MESSAGE`` is set in validation failure flags.
:param `message`:
:type `message`: string
:rtype: `None`
.. method:: Veto(self, veto: bool=True)
Call this from your event handler to veto action that the event is signaling.
You can only veto a shutdown if :meth:`wx.propgrid.PropertyGridEvent.CanVeto` returns ``True``.
:param `veto`:
:type `veto`: bool
:rtype: `None`
.. note::
Currently only ``wxEVT_PG_CHANGING`` supports vetoing.
.. method:: WasVetoed(self)
Returns ``True`` if event was vetoed.
:rtype: `bool`
.. attribute:: Column
See :meth:`~wx.propgrid.PropertyGridEvent.GetColumn`
.. attribute:: MainParent
See :meth:`~wx.propgrid.PropertyGridEvent.GetMainParent`
.. attribute:: Property
See :meth:`~wx.propgrid.PropertyGridEvent.GetProperty` and :meth:`~wx.propgrid.PropertyGridEvent.SetProperty`
.. attribute:: PropertyName
See :meth:`~wx.propgrid.PropertyGridEvent.GetPropertyName`
.. attribute:: PropertyValue
See :meth:`~wx.propgrid.PropertyGridEvent.GetPropertyValue`
.. attribute:: ValidationFailureBehavior
See :meth:`~wx.propgrid.PropertyGridEvent.GetValidationFailureBehavior` and :meth:`~wx.propgrid.PropertyGridEvent.SetValidationFailureBehavior`
.. attribute:: Value
See :meth:`~wx.propgrid.PropertyGridEvent.GetValue`