Tuto WINDEV Mobile 25

152 Part 5: Android and iOS: Developing an application ▶ To create a search button in the Action Bar: 1.  In the "General" tab of the description window of Action Bar: 2. Click number 2. The interface for typing an option in the toolbar is displayed. 3. Click the "+" button to add an option. A new default option is created at the top right. Modify the characteristics of this option: • In the "Caption" area, type "Find". • In the "Preset image" area, expand the list and select "Find". • Validate the description window. 4.  The code of this option is used to make the search area visible. To write this code: • Select (if necessary) the Action Bar of window. • Click the search button. • A drop-down menu with the "Find" option is displayed. • Right-click the option. • Select "Code" from the popup menu that is displayed. • Write the following WLanguage code in the event "Selecting the menu": ActionBarSearchVisible(True) 5. Save the modifications by clicking among the quick access buttons. 6. Close the code window (click X at the top right corner of code editor). 7. Select the Action Bar and display the associated code (press F2 or select "Code" from the popup menu). 8.  In the code editor, type the following WLanguage code in the event "Validating the search...": QRY_Products.ParamName = ACTB_ActionBar..SearchValue LooperDisplay(LOOP_QRY_Products,taReExecuteQuery) 9.  Let’s take a look at this WLanguage code: • The query parameter is initialized with the search value typed in the Action Bar. • Then, the Looper control is redisplayed by LooperDisplay . The taReExecuteQuery constant is used to re-run the base query of Looper control and therefore to take the new parameter into account. 10. Save the modifications by clicking among the quick access buttons. 11. Close the code window (click X at the top right corner of code editor). 12. A button for product addition can also be created in this window. This operation was already performed in the lesson 5.2 "Creating a new product". The same operations must be performed. Only the code of "+" button must be adapted. 13.  Test the window that was just created in the simulator ( among the quick access buttons). • Click the magnifier. • Type "Polo" in the search area. • Validate (ENTER key). • The list of products containing "Polo" is displayed.

RkJQdWJsaXNoZXIy NDQ0OA==