Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CS 106, Winter 2009 Class 8, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,

Similar presentations


Presentation on theme: "1 CS 106, Winter 2009 Class 8, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,"— Presentation transcript:

1 1 CS 106, Winter 2009 Class 8, Section 4 Slides by: Dr. Cynthia A. Brown, cbrown@cs.pdx.educbrown@cs.pdx.edu Instructor section 4: Dr. Herbert G. Mayer, herb@cs.pdx.eduherb@cs.pdx.edu

2 2 Midterm 1 Next Class! You may bring exactly one piece of paper with notes on it No electronic devices may be used Academic Honesty is expected – Absolutely no talking once the exam is given out. If you need something, raise your hand and wait for the proctor – No passing notes – No copying from someone else – No walking around – If you leave the room without asking, you can’t come back – No other unreasonable behavior – If you break the rules we will take your exam away and you will get a zero

3 3 Conditionals Last time we learned about program elements that let us write conditions and branches in programs – Boolean constants True and False – Relational operators to form Boolean Expressions – Boolean operators to build more complex expressions; truth tables to check them – If blocks, three types (with Else, with no Else, with ElseIfs) – Select Case blocks

4 4 New Controls Let’s start today by looking at a couple of new controls: radio buttons and check boxes We’ll use conditionals to determine which values have been set and have the program act accordingly

5 5 Radio Buttons Radio buttons come in groups. Only one button in the group can be selected. We use the prefix rad for this control. Let’s say there are three buttons in a group for choosing a size, Small, Medium, or Large We can name our buttons radSmall, radMedium, and radLarge

6 6 Creating Radio Buttons Choose the Radio Button tool in the Toolbox and create as many as you want in a group Go to the container section of the Toolbox and choose the group box tool Put a group box around the radio buttons in the group Name the buttons and change their text You are now ready to use them in a program

7 7 Check Boxes Check boxes are like radio buttons but differ in that more than one in a group can be checked While radio buttons make sense for choosing something like size or color, check boxes can be used for choosing something like features, where more than one can be chosen (AC, disk brakes, super sound package, leather seats, fancy wheels, etc.)

8 8 Creating Check Boxes It’s the same procedure as for radio buttons The logic of the associated conditional will be different since more than one can be checked We’ll use the prefix chk for this control Let’s pause here and look at an example

9 9 BREAK 10 minutes

10 10 Review Sheet Questions


Download ppt "1 CS 106, Winter 2009 Class 8, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,"

Similar presentations


Ads by Google