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.
EVT_TEXT_ENTER Sent when the RETURN/ENTER key is pressed in the combobox.

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)
bool CanCopy(self)
Returns True if the combobox is editable and there is a text selection to copy to the clipboard.
bool CanCut(self)
Returns True if the combobox is editable and there is a text selection to copy to the clipboard.
bool CanPaste(self)
Returns True if the combobox is editable and there is text on the clipboard that can be pasted into the text field.
bool CanRedo(self)
Returns True if the combobox is editable and the last undo can be redone.
bool CanUndo(self)
Returns True if the combobox is editable and the last edit can be undone.
  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.
(from, to) GetMark(self)
Gets the positions of the begining and ending of the selection mark in the combobox text field.
String GetValue(self)
Returns the current value in the combobox text field.
bool IsEditable(self)
Returns True if the combo is ediatable (not read-only.)
  Paste(self)
Pastes text from the clipboard to the text field.
  Redo(self)
Undoes the last edit in 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.
  SelectAll(self)
Select all the text in the combo's 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)
  Undo(self)
Redoes the last undo in the text field.

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__

CanCopy(self)

Returns True if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
Returns:
bool

CanCut(self)

Returns True if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
Returns:
bool

CanPaste(self)

Returns True if the combobox is editable and there is text on the clipboard that can be pasted into the text field. Only available on Windows.
Returns:
bool

CanRedo(self)

Returns True if the combobox is editable and the last undo can be redone. Only available on Windows.
Returns:
bool

CanUndo(self)

Returns True if the combobox is editable and the last edit can be undone. Only available on Windows.
Returns:
bool

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

GetMark(self)

Gets the positions of the begining and ending of the selection mark in the combobox text field.
Returns:
(from, to)

GetValue(self)

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

IsEditable(self)

Returns True if the combo is ediatable (not read-only.)
Returns:
bool

Paste(self)

Pastes text from the clipboard to the text field.

Redo(self)

Undoes the last edit in the text field. Windows only.

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)

SelectAll(self)

Select all the text in the combo's text field.

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.SetSelection

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
Overrides:
wx.ItemContainer.SetStringSelection

Undo(self)

Redoes the last undo in the text field. Windows only.

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 Apr 26 14:24:13 2005 http://epydoc.sf.net