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