WebSearchField

From Xojo Documentation

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.

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

Notes

The search string that the user entered is available in the WebSearchField.ValueChanged|ValueChanged]] event. Use the Value 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.Value + "&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 ValueChanged event handler displays the search text in a MessageBox:

MessageBox(Me.Value)

See Also

WebLabel, WebTextArea, WebTextField