| 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%% wxSearchCtrl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 | |
| 3 | \section{\class{wxSearchCtrl}}\label{wxsearchctrl} |
| 4 | |
| 5 | A search control is a composite control with a search button, a text |
| 6 | control, and a cancel button. |
| 7 | |
| 8 | \wxheading{Derived from} |
| 9 | |
| 10 | \helpref{wxTextCtrl}{wxtextctrl}\\ |
| 11 | streambuf\\ |
| 12 | \helpref{wxControl}{wxcontrol}\\ |
| 13 | \helpref{wxWindow}{wxwindow}\\ |
| 14 | \helpref{wxEvtHandler}{wxevthandler}\\ |
| 15 | \helpref{wxObject}{wxobject} |
| 16 | |
| 17 | \wxheading{Include files} |
| 18 | |
| 19 | <wx/srchctrl.h> |
| 20 | |
| 21 | \wxheading{Window styles} |
| 22 | |
| 23 | \twocolwidtha{5cm} |
| 24 | \begin{twocollist}\itemsep=0pt |
| 25 | \twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate |
| 26 | the event wxEVT\_COMMAND\_TEXT\_ENTER (otherwise pressing Enter key |
| 27 | is either processed internally by the control or used for navigation between |
| 28 | dialog controls).} |
| 29 | \twocolitem{\windowstyle{wxTE\_PROCESS\_TAB}}{The control will receive |
| 30 | wxEVT\_CHAR events for TAB pressed - normally, TAB is used for passing to the |
| 31 | next control in a dialog instead. For the control created with this style, |
| 32 | you can still use Ctrl-Enter to pass to the next control from the keyboard.} |
| 33 | \twocolitem{\windowstyle{wxTE\_NOHIDESEL}}{By default, the Windows text control |
| 34 | doesn't show the selection when it doesn't have focus - use this style to force |
| 35 | it to always show it. It doesn't do anything under other platforms.} |
| 36 | \twocolitem{\windowstyle{wxTE\_LEFT}}{The text in the control will be left-justified (default).} |
| 37 | \twocolitem{\windowstyle{wxTE\_CENTRE}}{The text in the control will be centered (currently wxMSW and wxGTK2 only).} |
| 38 | \twocolitem{\windowstyle{wxTE\_RIGHT}}{The text in the control will be right-justified (currently wxMSW and wxGTK2 only).} |
| 39 | \twocolitem{\windowstyle{wxTE\_CAPITALIZE}}{On PocketPC and Smartphone, causes the first letter to be capitalized.} |
| 40 | \end{twocollist} |
| 41 | |
| 42 | See also \helpref{window styles overview}{windowstyles} and \helpref{wxSearchCtrl::wxSearchCtrl}{wxsearchctrlctor}. |
| 43 | |
| 44 | \wxheading{Event handling} |
| 45 | |
| 46 | To process input from a search control, use these event handler macros to direct input to member |
| 47 | functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument. To retrieve actual search |
| 48 | queries, use EVT\_TEXT and EVT\_TEXT\_ENTER events, just as you would with \helpref{wxTextCtrl}{wxtextctrl}. |
| 49 | |
| 50 | \twocolwidtha{9cm}% |
| 51 | \begin{twocollist}\itemsep=0pt |
| 52 | \twocolitem{{\bf EVT\_SEARCHCTRL\_SEARCH\_BTN(id, func)}}{Respond to a wxEVT\_SEARCHCTRL\_SEARCH\_BTN event, |
| 53 | generated when the search button is clicked. Note that this does not initiate a search.} |
| 54 | \twocolitem{{\bf EVT\_SEARCHCTRL\_CANCEL\_BTN(id, func)}}{Respond to a wxEVT\_SEARCHCTRL\_CANCEL\_BTN event, |
| 55 | generated when the cancel button is clicked.} |
| 56 | \end{twocollist}% |
| 57 | |
| 58 | |
| 59 | \latexignore{\rtfignore{\wxheading{Members}}} |
| 60 | |
| 61 | |
| 62 | \membersection{wxSearchCtrl::wxSearchCtrl}\label{wxsearchctrlctor} |
| 63 | |
| 64 | \func{}{wxSearchCtrl}{\void} |
| 65 | |
| 66 | Default constructor. |
| 67 | |
| 68 | \func{}{wxSearchCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp |
| 69 | \param{const wxString\& }{value = ``"}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
| 70 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = wxSearchCtrlNameStr}} |
| 71 | |
| 72 | Constructor, creating and showing a text control. |
| 73 | |
| 74 | \wxheading{Parameters} |
| 75 | |
| 76 | \docparam{parent}{Parent window. Should not be NULL.} |
| 77 | |
| 78 | \docparam{id}{Control identifier. A value of -1 denotes a default value.} |
| 79 | |
| 80 | \docparam{value}{Default text value.} |
| 81 | |
| 82 | \docparam{pos}{Text control position.} |
| 83 | |
| 84 | \docparam{size}{Text control size.} |
| 85 | |
| 86 | \docparam{style}{Window style. See \helpref{wxSearchCtrl}{wxsearchctrl}.} |
| 87 | |
| 88 | \docparam{validator}{Window validator.} |
| 89 | |
| 90 | \docparam{name}{Window name.} |
| 91 | |
| 92 | \wxheading{See also} |
| 93 | |
| 94 | \helpref{wxTextCtrl::Create}{wxtextctrlcreate}, \helpref{wxValidator}{wxvalidator} |
| 95 | |
| 96 | |
| 97 | \membersection{wxSearchCtrl::\destruct{wxSearchCtrl}}\label{wxsearchctrldtor} |
| 98 | |
| 99 | \func{}{\destruct{wxSearchCtrl}}{\void} |
| 100 | |
| 101 | Destructor, destroying the search control. |
| 102 | |
| 103 | |
| 104 | \membersection{wxSearchCtrl::SetMenu}\label{wxsearchctrlsetmenu} |
| 105 | |
| 106 | \func{virtual void}{SetMenu}{\param{wxMenu* }{ menu}} |
| 107 | |
| 108 | Sets the search control's menu object. If there is already a menu associated with |
| 109 | the search control it is deleted. |
| 110 | |
| 111 | |
| 112 | \wxheading{Parameters} |
| 113 | |
| 114 | \docparam{menu}{Menu to attach to the search control.} |
| 115 | |
| 116 | \membersection{wxSearchCtrl::GetMenu}\label{wxsearchctrlgetmenu} |
| 117 | |
| 118 | \func{virtual wxMenu*}{GetMenu}{\void} |
| 119 | |
| 120 | Returns a pointer to the search control's menu object or NULL if there is no |
| 121 | menu attached. |
| 122 | |
| 123 | |
| 124 | \membersection{wxSearchCtrl::ShowSearchButton}\label{wxsearchctrlshowsearchbutton} |
| 125 | |
| 126 | \func{virtual void}{ShowSearchButton}{\param{bool }{ show}} |
| 127 | |
| 128 | Sets the search button visibility value on the search control. |
| 129 | If there is a menu attached, the search button will be visible regardless of the search |
| 130 | button visibility value. |
| 131 | |
| 132 | This has no effect in Mac OS X v10.3 |
| 133 | |
| 134 | |
| 135 | \membersection{wxSearchCtrl::IsSearchButtonVisible}\label{wxsearchctrlissearchbuttonvisible} |
| 136 | |
| 137 | \func{virtual bool}{IsSearchButtonVisible}{\void} |
| 138 | |
| 139 | Returns the search button visibility value. |
| 140 | If there is a menu attached, the search button will be visible regardless of the search |
| 141 | button visibility value. |
| 142 | |
| 143 | This always returns false in Mac OS X v10.3 |
| 144 | |
| 145 | |
| 146 | \membersection{wxSearchCtrl::ShowCancelButton}\label{wxsearchctrlshowcancelbutton} |
| 147 | |
| 148 | \func{virtual void}{ShowCancelButton}{\param{bool }{ show}} |
| 149 | |
| 150 | Shows or hides the cancel button. |
| 151 | |
| 152 | |
| 153 | \membersection{wxSearchCtrl::IsCancelButtonVisible}\label{wxsearchctrliscancelbuttonvisible} |
| 154 | |
| 155 | \func{virtual bool}{IsCancelButtonVisible}{\void} |
| 156 | |
| 157 | Indicates whether the cancel button is visible. |