Lec7 - Lecture 7 More Graphics PIC 10A Todd Wittman Sec 2.8...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 7: More Graphics PIC 10A Todd Wittman Sec 2.8 : Graphics Window Input r We’ve seen how the cwin function can output shapes and text, e.g. cwin << my_circle; r The cwin function can also be used to get different kinds of input from the graphics windows. c Text c Numbers c Mouse clicks r Use the member functions cwin.function( ) r The syntax cwin >> does not work. r The input prompt and response is shown in a box at the top of the window.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Getting Text: get_string r cwin has a member function get_string that can grab a text string from the user. r Pass the function a string to display. Prompts the user for input. r Returns a string. Since ccc_win uses the <string> library, we don’t need to include it to use strings. string name = cwin.get_string("Enter text: "); r The prompt and user input appears at the top of the graphics window. We can’t move it. r If you want text inside the window, use Message class. Getting Numbers: get_double r Similarly, we can get numbers as input. r Also provides a text prompt and appears at the top. r Can grab int and double number types. int x = cwin.get_int ("Enter int: "); double y = cwin.get_double ("Enter double: ");
Background image of page 2
3 Getting Mouse Clicks: get_mouse r Can also locate where the user clicks on the
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/27/2010 for the course PIC 157-050-21 taught by Professor Wittman during the Fall '10 term at UCLA.

Page1 / 8

Lec7 - Lecture 7 More Graphics PIC 10A Todd Wittman Sec 2.8...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online