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
ComboBox __init__(parent, id, value, pos, size, choices, style, validator, name)
Constructor, creates and shows a ComboBox control.
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.
bool Create(parent, id, value, pos, size, choices, style, validator, name)
Actually create the GUI wxComboBox control for 2-phase creation
  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)
int GetCurrentSelection(self)
Unlike GetSelection which only returns the accepted selection value, i.e.
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.
bool SetStringSelection(self, string)
Select the item with the specifed string
  SetValue(self, value)
  Undo(self)
Redoes the last undo in the text field.

Property Summary
  CurrentSelection: See GetCurrentSelection
  InsertionPoint: See GetInsertionPoint and SetInsertionPoint
  LastPosition: See GetLastPosition
  Mark: See GetMark and SetMark
  thisown: The membership flag
  Value: See GetValue and SetValue

Instance Method Details

__init__(parent, id=-1, value=EmptyString, pos=DefaultPosition, size=DefaultSize, choices=EmptyList, style=0, validator=DefaultValidator, name=ComboBoxNameStr)
(Constructor)

Constructor, creates and shows a ComboBox control.

Parameters:
parent
           (type=Window)

id
           (type=int)

value
           (type=String)

pos
           (type=Point)

size
           (type=Size)

choices
           (type=List)

style
           (type=long)

validator
           (type=Validator)

name
           (type=String)

Returns:
ComboBox
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(parent, id=-1, value=EmptyString, pos=DefaultPosition, size=DefaultSize, choices=EmptyList, style=0, validator=DefaultValidator, name=ChoiceNameStr)

Actually create the GUI wxComboBox control for 2-phase creation

Parameters:
parent
           (type=Window)

id
           (type=int)

value
           (type=String)

pos
           (type=Point)

size
           (type=Size)

choices
           (type=List)

style
           (type=long)

validator
           (type=Validator)

name
           (type=String)

Returns:
bool
Overrides:
wx.Control.Create

Cut(self)

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

GetCurrentSelection(self)

Unlike GetSelection which only returns the accepted selection value, i.e. the selection in the control once the user closes the dropdown list, this function returns the current selection. That is, while the dropdown list is shown, it returns the currently selected item in it. When it is not shown, its result is the same as for the other function.

Returns:
int

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)

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

Property Details

CurrentSelection

See GetCurrentSelection

Get Method:
GetCurrentSelection(self)

InsertionPoint

See GetInsertionPoint and SetInsertionPoint

Get Method:
GetInsertionPoint(self)
Set Method:
SetInsertionPoint(self, pos)

LastPosition

See GetLastPosition

Get Method:
GetLastPosition(self)

Mark

See GetMark and SetMark

Get Method:
GetMark(self)
Set Method:
SetMark(self, from, to)

thisown

The membership flag

Value

See GetValue and SetValue

Get Method:
GetValue(self)
Set Method:
SetValue(self, value)

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:48 2009 http://epydoc.sf.net