Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 5 - Control Manager / Control Manager Reference
Control Manager Routines


Creating Controls

To create a control, you should generally use the GetNewControl function, which takes information about the control from a control resource. Like menu resources, control resources isolate descriptive information from your application code, making your application easier to modify or translate. However, you can also use the NewControl function--for which you pass descriptive information in parameters--to create controls.

Both GetNewControl and NewControl return a handle to the control record of the newly created control. Thereafter, your application normally refers to the control by this handle, because most other Control Manager routines expect a control handle as their first parameter. When you create scroll bars and pop-up menus, you should store their handles in one of your application's own data structures for later reference.

When you use the Dialog Manager to implement buttons, radio buttons, checkboxes, and pop-up menus in alert boxes and dialog boxes, the Dialog Manager automatically uses the Control Manager to create these controls for you. If you implement other controls in alert or dialog boxes, and whenever you implement controls--such as scroll bars--in your application's windows, you must use either GetNewControl or NewControl to create these controls.


Subtopics
GetNewControl
NewControl

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996