Package wx :: Class ComboBox
[frames | no frames]

Type ComboBox

object --+                
         |                
    Object --+            
             |            
    EvtHandler --+        
                 |        
            Window --+    
                     |    
               Control --+
                         |
            object --+   |
                     |   |
         ItemContainer --+
                         |
                        ComboBox

Known Subclasses:
BaseMaskedComboBox

A combobox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down list with text field.

A combobox permits a single selection only. Combobox items are numbered from zero.

Styles

wx.CB_SIMPLE Creates a combobox with a permanently displayed list. Windows only.
wx.CB_DROPDOWN Creates a combobox with a drop-down list.
wx.CB_READONLY Same as wxCB_DROPDOWN but only the strings specified as the combobox choices can be selected, it is impossible to select (even from a program) a string which is not in the choices list.
wx.CB_SORT Sorts the entries in the list alphabetically.

Events

EVT_COMBOBOX Sent when an item on the list is selected. Note that calling GetValue in this handler will return the newly selected value.
EVT_TEXT Sent when the combobox text changes.

Method Summary
  __init__(self, *args, **kwargs)
Point pos=DefaultPosition, Size size=DefaultSize, List choices=[], long style=0, Validator validator=DefaultValidator, String name=ComboBoxNameStr) -> ComboBox
  __repr__(self)
  Copy(self)
Copies the selected text to the clipboard.
  Create(*args, **kwargs)
Point pos=DefaultPosition, Size size=DefaultSize, List choices=[], long style=0, Validator validator=DefaultValidator, String name=ChoiceNameStr) -> bool
  Cut(self)
Copies the selected text to the clipboard and removes the selection.
VisualAttributes GetClassDefaultAttributes(variant)
Get the default attributes for this class. (Static method)
long GetInsertionPoint(self)
Returns the insertion point for the combobox's text field.
long GetLastPosition(self)
Returns the last position in the combobox text field.
String GetValue(self)
Returns the current value in the combobox text field.
  Paste(self)
Pastes text from the clipboard to the text field.
  Remove(self, from, to)
Removes the text between the two positions in the combobox text field.
  Replace(self, from, to, value)
Replaces the text between two positions with the given text, in the combobox text field.
  SetEditable(self, editable)
  SetInsertionPoint(self, pos)
Sets the insertion point in the combobox text field.
  SetInsertionPointEnd(self)
Sets the insertion point at the end of the combobox text field.
  SetMark(self, from, to)
Selects the text between the two positions in the combobox text field.
  SetSelection(self, n)
Sets the item at index 'n' to be the selected item.
  SetString(self, n, string)
Set the label for the n'th item (zero based) in the list.
bool SetStringSelection(self, string)
Select the item with the specifed string
  SetValue(self, value)

Instance Method Details

__init__(self, *args, **kwargs)
(Constructor)

__init__(Window parent, int id, String value=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize, List choices=[], long style=0, Validator validator=DefaultValidator, String name=ComboBoxNameStr) -> ComboBox

Constructor, creates and shows a ComboBox control.

Overrides:
wx.Control.__init__

Copy(self)

Copies the selected text to the clipboard.

Create(*args, **kwargs)

Create(Window parent, int id, String value=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize, List choices=[], long style=0, Validator validator=DefaultValidator, String name=ChoiceNameStr) -> bool

Actually create the GUI wxComboBox control for 2-phase creation

Overrides:
wx.Control.Create

Cut(self)

Copies the selected text to the clipboard and removes the selection.

GetInsertionPoint(self)

Returns the insertion point for the combobox's text field.
Returns:
long

GetLastPosition(self)

Returns the last position in the combobox text field.
Returns:
long

GetValue(self)

Returns the current value in the combobox text field.
Returns:
String

Paste(self)

Pastes text from the clipboard to the text field.

Remove(self, from, to)

Removes the text between the two positions in the combobox text field.
Parameters:
from
           (type=long)
to
           (type=long)

Replace(self, from, to, value)

Replaces the text between two positions with the given text, in the combobox text field.
Parameters:
from
           (type=long)
to
           (type=long)
value
           (type=String)

SetInsertionPoint(self, pos)

Sets the insertion point in the combobox text field.
Parameters:
pos
           (type=long)

SetInsertionPointEnd(self)

Sets the insertion point at the end of the combobox text field.

SetMark(self, from, to)

Selects the text between the two positions in the combobox text field.
Parameters:
from
           (type=long)
to
           (type=long)

SetSelection(self, n)

Sets the item at index 'n' to be the selected item.
Parameters:
n
           (type=int)
Overrides:
wx.ItemContainer.Select

SetString(self, n, string)

Set the label for the n'th item (zero based) in the list.
Parameters:
n
           (type=int)
string
           (type=String)
Overrides:
wx.ItemContainer.SetString

SetStringSelection(self, string)

Select the item with the specifed string
Parameters:
string
           (type=String)
Returns:
bool

Static Method Details

GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)

Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the user's system, especially if it uses themes.

The variant parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the returned font. See wx.Window.SetWindowVariant for more about this.

Parameters:
variant
           (type=int)
Returns:
VisualAttributes

Generated by Epydoc 2.1.20040428.rpd on Tue Nov 9 17:04:22 2004 http://epydoc.sf.net