Tuto WINDEV 25

166 Part 4: Full application with data ▶ To create the Button control to launch the generic search: 1. Create a Button control: on the "Creation" pane, in the "Usual controls" group, click . 2. Position the control beside the edit control that was just created. 3.  This control is named "BTN_GenericSearch" and its caption is "Generic search". 4.  If necessary, adjust the size of the control so that the caption is displayed properly in the control. 5. Write the following WLanguage code in the "Click" event of the button: // Finds a customer from his name HReadSeek(Customer, FullName, EDT_Sought_Name) IF HFound(Customer) THEN // Displays the customer data FileToScreen() ELSE Error("No customer matches") END HReadSeek is used to perform a generic search. In this example, the search is performed on the "Customer" data file and on the "FullName" item. The sought value corresponds to the value typed in the "EDT_Sought_Name" control. This value is obtained by using the control name. Remark To perform an exact-match search, call HReadSeek : to do so, the hIdentical constant must be used. 6. Close the code window. 7. Save the window (Ctrl + S). ▶ Let’s run a window test: 1. Run the window test ( among the quick access buttons). 2. Click the "Finding customers" tab pane if necessary.

RkJQdWJsaXNoZXIy NDQ0OA==