© Wallace Wang 2017

Wallace Wang, macOS Programming for Absolute Beginners, 10.1007/978-1-4842-2662-9_19

19. Using Text with Labels, Text Fields, and Combo Boxes

Wallace Wang

(1)San Diego, California, USA

When a program needs to offer a limited range of valid options to the user, that’s when you want to use check boxes, radio buttons, date pickers, or sliders. However, sometimes a program needs to allow the user to type in data that can never be predicted ahead of time, such as a person’s name. When a program needs to allow the user to type in data, that’s when you need to use a text field or a combo box.

A text field lets the user type in numbers, unusual characters, or ordinary letters. This means a program may need to verify that the user typed ...

Get macOS Programming for Absolute Beginners: Developing Apps Using Swift and Xcode now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.