A search control is a composite control with a search button, a text control, and a cancel button.
Derived from
wxTextCtrl
streambuf
wxControl
wxWindow
wxEvtHandler
wxObject
Include files
<wx/srchctrl.h>
Window styles
wxTE_PROCESS_ENTER | The control will generate the event wxEVT_COMMAND_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). |
wxTE_PROCESS_TAB | The control will receive wxEVT_CHAR events for TAB pressed - normally, TAB is used for passing to the next control in a dialog instead. For the control created with this style, you can still use Ctrl-Enter to pass to the next control from the keyboard. |
wxTE_NOHIDESEL | By default, the Windows text control doesn't show the selection when it doesn't have focus - use this style to force it to always show it. It doesn't do anything under other platforms. |
wxTE_LEFT | The text in the control will be left-justified (default). |
wxTE_CENTRE | The text in the control will be centered (currently wxMSW and wxGTK2 only). |
wxTE_RIGHT | The text in the control will be right-justified (currently wxMSW and wxGTK2 only). |
wxTE_CAPITALIZE | On PocketPC and Smartphone, causes the first letter to be capitalized. |
See also window styles overview and wxSearchCtrl::wxSearchCtrl.
Event handling
To process input from a search control, use these event handler macros to direct input to member functions that take a wxCommandEvent argument. To retrieve actual search queries, use EVT_TEXT and EVT_TEXT_ENTER events, just as you would with wxTextCtrl.
EVT_SEARCHCTRL_SEARCH_BTN(id, func) | Respond to a wxEVT_SEARCHCTRL_SEARCH_BTN event, generated when the search button is clicked. Note that this does not initiate a search. |
EVT_SEARCHCTRL_CANCEL_BTN(id, func) | Respond to a wxEVT_SEARCHCTRL_CANCEL_BTN event, generated when the cancel button is clicked. |
wxSearchCtrl::wxSearchCtrl
wxSearchCtrl::~wxSearchCtrl
wxSearchCtrl::SetMenu
wxSearchCtrl::GetMenu
wxSearchCtrl::ShowSearchButton
wxSearchCtrl::IsSearchButtonVisible
wxSearchCtrl::ShowCancelButton
wxSearchCtrl::IsCancelButtonVisible
wxSearchCtrl()
Default constructor.
wxSearchCtrl(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSearchCtrlNameStr)
Constructor, creating and showing a text control.
Parameters
parent
id
value
pos
size
style
validator
name
See also
wxTextCtrl::Create, wxValidator
~wxSearchCtrl()
Destructor, destroying the search control.
virtual void SetMenu(wxMenu* menu)
Sets the search control's menu object. If there is already a menu associated with the search control it is deleted.
Parameters
menu
virtual wxMenu* GetMenu()
Returns a pointer to the search control's menu object or NULL if there is no menu attached.
virtual void ShowSearchButton(bool show)
Sets the search button visibility value on the search control. If there is a menu attached, the search button will be visible regardless of the search button visibility value.
This has no effect in Mac OS X v10.3
virtual bool IsSearchButtonVisible()
Returns the search button visibility value. If there is a menu attached, the search button will be visible regardless of the search button visibility value.
This always returns false in Mac OS X v10.3
virtual void ShowCancelButton(bool show)
Shows or hides the cancel button.
virtual bool IsCancelButtonVisible()
Indicates whether the cancel button is visible.