Chapter 3- Data Types and Operators Boolean Expressions Page 2 3 4

Introduction

The If Statement Page 2 3 4 5 6 7 8 9
Arithmetic Operations Page 2 3 4 5 6 Boolean Operators and Nested If Statements Page 2 3 4 5 6 7
Events and Sequential Processing Page 2 3 4 5 More Examples Page 2 3 4 5 6 7 8 9 10 11 12
Datatypes and Conversions Page 2 3 4 5 6 7 Using Check Box and Option Controls Page 2 3 4 5 6 7 8 9 10
Variable Declarations - Local and Global Page 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Exercises Page 2 3 4 5 6 7 8
Chapter 4- Selection Statements Review Questions
Introduction

4-7: Check Box and Option Controls

Exercise 4-6: Global Classics Cinema: The Groups of Radio Buttons

The movies showing at the moment are included in the interface as a group of radio buttons. Clearly only one of these should be selected at any time. It would not make sense to have two or more selected. Normally, objects are entirely separate and can each be manipulated independently of any other. However, these option objects are linked as soon as you place them on the form. If the movie selection radio buttons were not contained within a GroupBox control and if the time selection radio buttons were not also grouped these radio buttons would be linked so that only one of the seven could be selected at any one time.

Thus, for this program, as shown in Figure 4-11, there are two GroupBox objects - i.e. the rectangular boxes framing the listing of movies and times. In creating this interface you should first create the two GroupBox objects, setting the Text property of one to Movie and the other to Time.

Next place the radio button objects within the Movie frame, naming them rdoMovie1, rdoMovie2 , ... etc ( note the prefix). Also change the Text

Do the same for the times, choosing names such as rdoTime1 , etc. Also set the Text properties, of course.

You can test the interface right now, without having written any code. Start the program and you should observe that if you click on one movie radio button, and then a different one, the first is deselected, i.e. only one radio button can be selected at a time. Similarly for the time radio buttons.