Base class for custom wx.propgrid.PropertyGrid editors.
Note
wx.propgrid.PropertyGrid.RegisterAdditionalEditors
prior use.wx.propgrid.PropertyGrid.RegisterEditorClass
, with code like this:editorPointer = wx.propgrid.PropertyGrid.RegisterEditorClass(MyEditorClass(), “MyEditor”)
After that, wx.propgrid.PropertyGrid will take ownership of the given object, but you should still store editorPointer somewhere, so you can pass it to wx.propgrid.PGProperty.SetEditor
, or return it from PGEditor.DoGetEditorClass().
wx.propgrid.PGCheckBoxEditor, wx.propgrid.PGChoiceEditor, wx.propgrid.PGTextCtrlEditor
__init__ |
Constructor. |
CanContainCustomImage |
Returns True if control itself can contain the custom image. |
CreateControls |
Instantiates editor controls. |
DeleteItem |
Deletes item from existing control. |
DrawValue |
Draws value for given property. |
GetName |
Returns pointer to the name of the editor. |
GetValueFromControl |
Returns value from control, via parameter ‘variant’. |
InsertItem |
Inserts item to existing control. |
OnEvent |
Handles events. |
OnFocus |
Extra processing when control gains focus. |
SetControlAppearance |
Called by property grid to set new appearance for the control. |
SetControlIntValue |
Sets control’s value specifically from int (applies to choice etc.). |
SetControlStringValue |
Sets control’s value specifically from string. |
SetValueToUnspecified |
Sets value in control to unspecified. |
UpdateControl |
Loads value from property to the control. |
wx.propgrid.
PGEditor
(Object)¶Possible constructors:
PGEditor()
Base class for custom PropertyGrid editors.
__init__
(self)¶Constructor.
CanContainCustomImage
(self)¶Returns True
if control itself can contain the custom image.
Default implementation returns False
.
Return type: | bool |
---|
CreateControls
(self, propgrid, property, pos, size)¶Instantiates editor controls.
Parameters: |
|
---|---|
Return type: |
Note
PG_SUBID1
, and secondary (button) control shall use PG_SUBID2
.wx.EvtHandler.Connect
for interesting editor events. Instead, all events from control are now automatically forwarded to wx.propgrid.PGEditor.OnEvent
and wx.propgrid.PGProperty.OnEvent
.DeleteItem
(self, ctrl, index)¶Deletes item from existing control.
Default implementation does nothing.
Parameters: |
|
---|
DrawValue
(self, dc, rect, property, text)¶Draws value for given property.
Parameters: |
|
---|
GetName
(self)¶Returns pointer to the name of the editor.
For example, PGEditor_TextCtrl has name “TextCtrl”. If you dont’ need to access your custom editor by string name, then you do not need to implement this function.
Return type: | string |
---|
GetValueFromControl
(self, property, ctrl)¶Returns value from control, via parameter ‘variant’.
Usually ends up calling property’s StringToValue() or IntToValue(). Returns True
if value was different.
Parameters: |
|
---|---|
Return type: | tuple |
Returns: | ( bool, variant ) |
InsertItem
(self, ctrl, label, index)¶Inserts item to existing control.
Index -1 means end of list. Default implementation does nothing. Returns index of item added.
Parameters: |
|
---|---|
Return type: | int |
OnEvent
(self, propgrid, property, wnd_primary, event)¶Handles events.
Returns True
if value in control was modified (see wx.propgrid.PGProperty.OnEvent
for more information).
Parameters: |
|
---|---|
Return type: | bool |
Note
wx.propgrid.PropertyGrid will automatically unfocus the editor when wxEVT_TEXT_ENTER
is received and when it results in property value being modified. This happens regardless of editor type (ie. behaviour is same for any wx.TextCtrl and wx.ComboBox based editor).
OnFocus
(self, property, wnd)¶Extra processing when control gains focus.
For example, wx.TextCtrl based controls should select all text.
Parameters: |
|
---|
SetControlAppearance
(self, pg, property, ctrl, appearance, oldAppearance, unspecified)¶Called by property grid to set new appearance for the control.
Default implementation sets foreground colour, background colour, font, plus text for wx.TextCtrl and wx.ComboCtrl.
The parameter appearance represents the new appearance to be applied.
The parameter oldAppearance is the previously applied appearance. Used to detect which control attributes need to be changed (e.g. so we only change background colour if really needed).
Finally, the parameter unspecified if True
tells this function that the new appearance represents an unspecified property value.
Parameters: |
|
---|
SetControlIntValue
(self, property, ctrl, value)¶Sets control’s value specifically from int (applies to choice etc.).
Parameters: |
|
---|
SetControlStringValue
(self, property, ctrl, txt)¶Sets control’s value specifically from string.
Parameters: |
|
---|
SetValueToUnspecified
(self, property, ctrl)¶Sets value in control to unspecified.
Parameters: |
|
---|
UpdateControl
(self, property, ctrl)¶Loads value from property to the control.
Parameters: |
|
---|