From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from WebUIControl)

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.

Closed Opening TextChanged
ContextualMenuSelected Pressed
Hidden Shown
ContextualMenu LockHorizontal fa-lock-32.png TabIndex
ControlID fa-lock-32.png LockLeft fa-lock-32.png Text
Enabled LockRight fa-lock-32.png Tooltip
Height LockVertical fa-lock-32.png Top
Hint Name fa-lock-32.png Visible
Indicator Page fa-lock-32.png Width
Left Parent fa-lock-32.png
LockBottom fa-lock-32.png Style
Close GotoURL UpdateBrowser
ExecuteJavaScript SetFocus


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 MessageBox:


See Also

WebLabel, WebTextArea, WebTextField