From Xojo Documentation

Class (inherits from WebTextControl)

Used for entering a value with which a search will be performed. This control is just a user interface control and does not do the searching itself. However, it does provide a recent searches popup menu of values that were recently entered by the user. To do a search, add code to the TextChanged event.

Close KeyPressed MouseUp
ContextualMenuAction LostFocus Open
DoubleClick MouseDown Resized
DropObject MouseEnter Shown
GotFocus MouseExit TextChanged
Hidden MouseMove
ContextualMenu Left Style
ControlID fa-lock-32.png LockBottom Text
CueText LockHorizontal TextAlign
Cursor LockLeft Top
DragOverStyle LockRight VerticalCenter
Enabled LockTop Visible
HasFocusRing LockVertical Width
Height Name fa-lock-32.png Zindex
HelpTag Page fa-lock-32.png
HorizontalCenter Parent fa-lock-32.png
AcceptPictureDrop AllowRawDataDrag MsgBox
AcceptRawDataDrop AllowTextDrag PresentContextualMenu
AcceptTextDrop Close SetFocus
AllowPictureDrag ExecuteJavaScript ShowURL


The search string that the user entered is available in the TextChanged event. Use the Text property in this event to pass it to the engine that will conduct the search. Of course, there are many search engines that you can use.

This example is based on Safari's standard seach string that uses Google.

ShowURL("http://www.google.com/search?client=safari&rls=en&q=" + Me.Text + "&ie=UTF-8&oe=UTF-8")

Recent Searches Menu

WebKit-based browsers may show a Recent Searches menu within this control. The searches on the Recent Searches menu are stored in a cookie and are specific to the name of the WebSearchField within an application. For example, if you have two WebSearchFields with the name "SearchField1" in the same application, the user will see the same Recent Searches menu for both. However, if the two WebSearchFields have different names or are in different applications, the menus will not contain the same data.

Sample Code

This code in the TextChanged event handler displays the search text in a MsgBox:


See Also

WebLabel, WebTextArea, WebTextField