With Xojo 2020r2 you can now add to your Window Layouts a native Search control for your desktop apps, getting the same look and feel and behavior you’d expect from the OS itself.
For example, on macOS you will be able to offer a Recent Items popup menu contained in the search field itself, setting even through the Panel Inspector (or via code) the maximum number of allowed recent items. Of course, you will be able to set a localized text for the Hint property of the control.
- The implementation of the control logic in your apps couldn’t be more easy: Drag and drop the SearchField control from the Library to the Window Layout. Add the TextChanged event to the control instance. And write the code that should be executed every time the SearchField text changes.
In addition, you can also implement the Pressed event handler. This one will be called everytime the user hits the Return key, clicks on the “Clear” button or selects an item from those available in the “Recent Items” menu.
Lastly, all the properties are settable both at design time using the Inspector Panel, or via code at runtime; so you can change, for example, if the SearchField instance displays the “Recent Items” menu or not, the number of allowed items or the text for the Hint, and also the “Clear” and “Recent Searches” texts.