CS 106 Computing Fundamentals II Chapter 35 - PowerPoint PPT Presentation

About This Presentation
Title:

CS 106 Computing Fundamentals II Chapter 35

Description:

Title: Ethics Last modified by: herbert mayer Document presentation format: On-screen Show (4:3) Other titles: Times New Roman MS PGothic Helvetica Wingdings MS P ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 11
Provided by: pdx76
Learn more at: http://web.cecs.pdx.edu
Category:

less

Transcript and Presenter's Notes

Title: CS 106 Computing Fundamentals II Chapter 35


1
CS 106Computing Fundamentals IIChapter
35Controls For Choices
  • Herbert G. Mayer, PSU CS
  • Status 7/17/2013
  • Initial content copied verbatim from
  • CS 106 material developed by
  • CS professors Cynthia Brown Robert Martin

2
Syllabus
  • Controls For Choices
  • Option Button
  • Creating Option Buttons
  • About the Demo
  • Events

3
Controls for Choices
  • Lets look at new controls option buttons and
    check boxes
  • These controls are designed to be used when you
    want the user of the program to have choices
  • Well use conditionals to determine which values
    have been set and have the program act accordingly

4
Option Buttons
  • Option buttons come in groups, but only one
    button in the group can be selected
  • We use the prefix opt for this control. Lets say
    there are three buttons in a group for choosing a
    size, Small, Medium, or Large
  • We can name our buttons optSmall, optMedium, and
    optLarge

5
Creating Option Buttons
  • Generally start with a frame!! Then place Option
    Buttons into the frame such as
  • Choose the Option Button tool in the Toolbox and
    create as many as you want in a group
  • Name the buttons and change their text
  • Notice that the buttons are round
  • You are now ready to use them in a program

6
Check Boxes
  • Check boxes are similar to option buttons but
    more than one in a group can be checked
  • While option buttons make sense for choosing
    something like model 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.)

7
Creating Check Boxes
  • Its the same procedure as for option buttons,
    but the frame is optional
  • Yet if you pick a frame, create it first
  • The logic of the associated conditional will be
    different since more than one can be checked
  • Well use the prefix chk for these named control

8
OptionDemo If statements, check boxes, option
buttons, demonstrated by showing HW3
9
About the Demo
  • Check if an option -or check box- Value is True
    to see if it is selected
  • If chkTaller.Value Then
  • btnPush.Height btnPush.Height 2
  • End If
  • sometimes programmers code
  • If chkTaller.Value True Then
  • btnPush.Height btnPush.Height 2
  • End If

10
Events
  • Checking a box or selecting a button is an event.
    But if there is no code for an event, nothing
    happens
  • There is no code for the event of selecting the
    red, blue, and green buttons. In HW3, their
    values are checked during the btnPush click event
Write a Comment
User Comments (0)
About PowerShow.com