Tuto WEBDEV 25

448 Part 13: The WLanguage basics SWITCH statement In our example, the Test Button control is used to test the selected value and to display a message. ▶ We are going to enter the WLanguage code associated with the Test Button control: 1. Select the Test Button control. 2. Press F2. 3. Write the following code in the event "Click BTN_Test (Server code)": SWITCH RADIO_NoName1 4. When the Enter key is pressed to go to the next line, the code editor automatically displays the different SWITCH capabilities: 5. Write the following code: SWITCH RADIO_NoName1 // Mr CASE 1 Info("You’ve selected Mr") // Mrs CASE 2 Info("You’ve selected Mrs") // Miss CASE 3 Info("You’ve selected Miss") // Other CASE 4 Info("You’ve selected Other") END Let’s study this code: • RADIO_NoName1 corresponds to the name of Radio Button control. • The Radio Button control is a control proposing several options (4 in our case). A single option can be checked at a time. The Radio Button control corresponds in programming to an Integer variable. Each menu option is associated with a value. If this option is checked, the Radio Button control takes for value the identifier of checked option. • This code tests the value of the Radio Button control. A message is displayed according to the value of Radio Button control.

RkJQdWJsaXNoZXIy NDQ0OA==