Tuto WEBDEV 25

Part 13: The WLanguage basics 445 ▶ The "Close" Button control must be invisible when the page is opened. This information corresponds to its "initial status". We are going to modify this status in the description window of control: 1. Select the "Close" Button control. 2. Display the popup menu of control and select "Description". 3.  In the "UI" tab, modify the initial status of control by clicking "Visible". This option is now unchecked. 4. Validate the control description window. 5.  The "Close" Button control is still visible in the editor. Its status was changed in execution only. 6. Save the modifications by clicking among the quick access button (on the left of ribbon) or by pressing Ctrl + S. Conditional IF statement In our example, a click on the check box must trigger the display of Close button. We are going to type the WLanguage code associated with the check box. ▶ To type the WLanguage code associated with the Check Box control: 1. Select the Check Box control. 2. Press F2. 3. Write the following code in the event "Exit with modification of CBOX_NoName1 (browser code)": IF CBOX_NoName1 = True THEN BTN_Close..Visible = True ELSE BTN_Close..Visible = False END Let’s study this code: • CBOX_NoName1 and BTN_Close respectively correspond to the names of Check Box and Button controls. Tip To handle the current control in one of the events associated with it, you can use the keyword MySelf. In our example, you also have the ability to write: IF MySelf = True THEN • The Check Box control is a 2-state control: checked/unchecked. It corresponds in programming to a Boolean variable. If the control is checked, its value is set to True ; if the control is unchecked, its value is set to False. • This code tests the value of the Check Box control. • If Check Box control is checked, Button control BTN_Close becomes visible using ..Visible . • If the Check Box control is unchecked, the Button control BTN_Close becomes invisible.

RkJQdWJsaXNoZXIy NDQ0OA==