wxComboBoxA 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; or a drop-down list without a text field. A combobox permits a single selection only. Combobox items are numbered from zero. If you need a customized combobox, have a look at wxComboCtrl, wxOwnerDrawnComboBox, wxComboPopup and the ready-to-use wxBitmapComboBox. Derived from
wxControlWithItems Include files <wx/combobox.h> Window styles
See also window styles overview. Event handling
See also wxListBox, wxTextCtrl, wxChoice, wxCommandEvent Members
wxComboBox::wxComboBox
wxComboBox::wxComboBoxwxComboBox() Default constructor. wxComboBox(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox") wxComboBox(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox") Constructor, creating and showing a combobox. Parameters parent
id
value
pos
size
n
choices
style
validator
name
See also wxComboBox::Create, wxValidator wxPython note: The wxComboBox constructor in wxPython reduces the n and choices arguments are to a single argument, which is a list of strings. wxPerl note: In wxPerl there is just an array reference in place of n and choices.
wxComboBox::~wxComboBox~wxComboBox() Destructor, destroying the combobox.
wxComboBox::Createbool Create(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox") bool Create(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox") Creates the combobox for two-step construction. Derived classes should call or replace this function. See wxComboBox::wxComboBox for further details.
wxComboBox::CanCopybool CanCopy() const Returns true if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
wxComboBox::CanCutbool CanCut() const Returns true if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
wxComboBox::CanPastebool CanPaste() const 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.
wxComboBox::CanRedobool CanRedo() const Returns true if the combobox is editable and the last undo can be redone. Only available on Windows.
wxComboBox::CanUndobool CanUndo() const Returns true if the combobox is editable and the last edit can be undone. Only available on Windows.
wxComboBox::Copyvoid Copy() Copies the selected text to the clipboard.
wxComboBox::Cutvoid Cut() Copies the selected text to the clipboard and removes the selection.
wxComboBox::GetCurrentSelectionint GetCurrentSelection() const This function does the same things as wxChoice::GetCurrentSelection and returns the item currently selected in the dropdown list if it's open or the same thing as GetSelection otherwise.
wxComboBox::GetInsertionPointlong GetInsertionPoint() const Returns the insertion point for the combobox's text field. Note: Under wxMSW, this function always returns 0 if the combobox doesn't have the focus.
wxComboBox::GetLastPositionvirtual wxTextPos GetLastPosition() const Returns the last position in the combobox text field.
wxComboBox::GetSelectionvoid GetSelection(long *from, long *to) const This is the same as wxTextCtrl::GetSelection for the text control which is part of the combobox. Notice that this is a different method from wxControlWithItems::GetSelection. Currently this method is only implemented in wxMSW and wxGTK.
wxComboBox::GetValuewxString GetValue() const Returns the current value in the combobox text field.
wxComboBox::Pastevoid Paste() Pastes text from the clipboard to the text field.
wxComboBox::Redovoid Redo() Redoes the last undo in the text field. Windows only.
wxComboBox::Replacevoid Replace(long from, long to, const wxString& text) Replaces the text between two positions with the given text, in the combobox text field. Parameters from
to
text
wxComboBox::Removevoid Remove(long from, long to) Removes the text between the two positions in the combobox text field. Parameters from
to
wxComboBox::SetInsertionPointvoid SetInsertionPoint(long pos) Sets the insertion point in the combobox text field. Parameters pos
wxComboBox::SetInsertionPointEndvoid SetInsertionPointEnd() Sets the insertion point at the end of the combobox text field.
wxComboBox::SetSelectionvoid SetSelection(long from, long to) Selects the text between the two positions, in the combobox text field. Parameters from
to
wxPython note: This method is called SetMark in wxPython, SetSelection name is kept for wxControlWithItems::SetSelection.
wxComboBox::SetValuevoid SetValue(const wxString& text) Sets the text for the combobox text field. NB: For a combobox with wxCB_READONLY style the string must be in the combobox choices list, otherwise the call to SetValue() is ignored. Parameters text
wxComboBox::Undovoid Undo() Undoes the last edit in the text field. Windows only.
|