15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

296<br />

Elements of a User Interface<br />

Figure 10-7:<br />

Toolboxes<br />

provide<br />

another way<br />

to group<br />

icons <strong>for</strong><br />

easy<br />

access.<br />

Giving data to the user interface<br />

Besides giving a program commands, users also need to give a program data<br />

to use <strong>for</strong> calculating a useful result. At the simplest level, users can just<br />

type in data they want to give the program. To accept typed-in data, user<br />

interfaces need to display a text box.<br />

A text box is nothing more than a box <strong>for</strong> the user to click and type something<br />

in it. Text boxes are commonly used when the program needs data that<br />

can’t be predicted in advance, such as asking <strong>for</strong> someone’s name, as shown<br />

in Figure 10-8.<br />

Figure 10-8:<br />

Users can<br />

type any<br />

in<strong>for</strong>mation<br />

inside a text<br />

box,<br />

including<br />

invalid data.<br />

Text boxes are great <strong>for</strong> accepting any data, such as names, passwords, or<br />

search phrases, but text boxes also allow users to type in invalid data. To<br />

weed out invalid data, write extra code to verify that any in<strong>for</strong>mation typed<br />

into a text box is actually valid.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!