Phoenix Logo

phoenix_title wx.ComboPopup

In order to use a custom popup with wx.ComboCtrl, an interface class must be derived from wx.ComboPopup.

For more information on how to use it, see Setting Custom Popup for wxComboCtrl.

See also

wx.ComboCtrl


class_hierarchy Class Hierarchy

Inheritance diagram for class ComboPopup:


method_summary Methods Summary

__init__ Default constructor.
Create The derived class must implement this to create the popup control.
DestroyPopup You only need to implement this member function if you create your popup class in non-standard way.
Dismiss Utility function that hides the popup.
FindItem Implement to customize matching of value string to an item container entry.
GetAdjustedSize The derived class may implement this to return adjusted size for the popup control, according to the variables given.
GetComboCtrl Returns pointer to the associated parent wx.ComboCtrl.
GetControl The derived class must implement this to return pointer to the associated control created in Create .
GetStringValue The derived class must implement this to return string representation of the value.
Init The derived class must implement this to initialize its internal variables.
IsCreated Utility method that returns True if Create has been called.
LazyCreate The derived class may implement this to return True if it wants to delay call to Create until the popup is shown for the first time.
OnComboDoubleClick The derived class may implement this to do something when the parent wx.ComboCtrl gets double-clicked.
OnComboKeyEvent The derived class may implement this to receive key events from the parent wx.ComboCtrl.
OnDismiss The derived class may implement this to do special processing when popup is hidden.
OnPopup The derived class may implement this to do special processing when popup is shown.
PaintComboControl The derived class may implement this to paint the parent wx.ComboCtrl.
SetStringValue The derived class must implement this to receive string value changes from wx.ComboCtrl.

api Class API



class wx.ComboPopup(object)

Possible constructors:

ComboPopup()

In order to use a custom popup with ComboCtrl, an interface class must be derived from ComboPopup.


Methods



__init__(self)

Default constructor.

It is recommended that internal variables are prepared in Init instead (because m_combo is not valid in constructor).



Create(self, parent)

The derived class must implement this to create the popup control.

Parameters:parent (wx.Window) –
Return type:bool
Returns:True if the call succeeded, False otherwise.


DestroyPopup(self)

You only need to implement this member function if you create your popup class in non-standard way.

The default implementation can handle both multiple-inherited popup control (as seen in wx.ComboCtrl samples) and one allocated separately in heap.

If you do completely re-implement this function, make sure it calls Destroy() for the popup control and also deletes this object (usually as the last thing).



Dismiss(self)

Utility function that hides the popup.



FindItem(self, item, trueItem=None)

Implement to customize matching of value string to an item container entry.

Parameters:
  • item (string) – String entered, usually by user or from SetValue() call.
  • trueItem (string) – When item matches an entry, but the entry’s string representation is not exactly the same (case mismatch, for example), then the True item string should be written back to here, if it is not a None pointer.
Return type:

bool

Note

Default implementation always return True and does not alter trueItem.



GetAdjustedSize(self, minWidth, prefHeight, maxHeight)

The derived class may implement this to return adjusted size for the popup control, according to the variables given.

Parameters:
  • minWidth (int) – Preferred minimum width.
  • prefHeight (int) – Preferred height. May be -1 to indicate no preference.
  • maxHeight (int) – Max height for window, as limited by screen size.
Return type:

wx.Size

Note

This function is called each time popup is about to be shown.



GetComboCtrl(self)

Returns pointer to the associated parent wx.ComboCtrl.

Return type: wx.ComboCtrl


GetControl(self)

The derived class must implement this to return pointer to the associated control created in Create .

Return type: wx.Window


GetStringValue(self)

The derived class must implement this to return string representation of the value.

Return type:string


Init(self)

The derived class must implement this to initialize its internal variables.

This method is called immediately after construction finishes. m_combo member variable has been initialized before the call.



IsCreated(self)

Utility method that returns True if Create has been called.

Useful in conjunction with LazyCreate .

Return type:bool


LazyCreate(self)

The derived class may implement this to return True if it wants to delay call to Create until the popup is shown for the first time.

It is more efficient, but on the other hand it is often more convenient to have the control created immediately.

Return type:bool

Note

Base implementation returns False.



OnComboDoubleClick(self)

The derived class may implement this to do something when the parent wx.ComboCtrl gets double-clicked.



OnComboKeyEvent(self, event)

The derived class may implement this to receive key events from the parent wx.ComboCtrl.

Events not handled should be skipped, as usual.

Parameters:event (wx.KeyEvent) –


OnDismiss(self)

The derived class may implement this to do special processing when popup is hidden.



OnPopup(self)

The derived class may implement this to do special processing when popup is shown.



PaintComboControl(self, dc, rect)

The derived class may implement this to paint the parent wx.ComboCtrl.

Default implementation draws value as string.

Parameters:


SetStringValue(self, value)

The derived class must implement this to receive string value changes from wx.ComboCtrl.

Parameters:value (string) –

Properties



ComboCtrl

See GetComboCtrl



Control

See GetControl



StringValue

See GetStringValue and SetStringValue