Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

Difference between revisions of "Macintosh Toolbox"

From Higher Intellect Vintage Wiki
Jump to navigation Jump to search
Line 4: Line 4:
  
 
The Macintosh Toolbox encompasses a number of system software routines, most (but not all) of which help present your application’s interface to the user. Some of these routines include those provided by the Event Manager, Menu Manager, Window Manager, Control Manager, Dialog Manager, Help Manager, Resource Manager, and Scrap Manager.
 
The Macintosh Toolbox encompasses a number of system software routines, most (but not all) of which help present your application’s interface to the user. Some of these routines include those provided by the Event Manager, Menu Manager, Window Manager, Control Manager, Dialog Manager, Help Manager, Resource Manager, and Scrap Manager.
 +
 +
=Overview of the Macintosh Toolbox=
 +
Macintosh system software contains a powerful set of routines that your application can use to create windows, manage menus, paint objects, display text, open files, share data between programs, and print files, as well as perform many other helpful tasks.
 +
 +
The Macintosh Toolbox encompasses a number of system software routines, most (but not all) of which help present your application's interface to the user. Some of these routines include those provided by the Event Manager, Menu Manager, Window Manager, Control Manager, Dialog Manager, Help Manager, Resource Manager, and Scrap Manager.
 +
 +
You can directly call these routines from within your application. By using system software routines, you can take advantage of the many tasks they can perform for
 +
you, and you can concentrate on the parts of your application that are specific to
 +
your particular product.
 +
 +
Using the Macintosh Toolbox, you can
 +
* respond to user actions, such as mouse actions or keyboard input
 +
* create and display menus
 +
* create and display windows, alert boxes, and dialog boxes
 +
* create and display controls in windows, alert boxes, and dialog boxes
 +
* create icons for your application and its documents
 +
 +
===Events===
 +
At the core of every Macintosh application is the application's event loop. The event loop is that piece of code in an application that processes and responds to user actions and other events. You can use the Event Manager to retrieve information about these actions. For example, you can get information that tells your application whether the user pressed a key or the mouse button, whether one of your application's windows needs updating as a result of the user moving windows, or whether some other hardware or software action requires a response from your application.
 +
 +
You should structure your application so that it can respond to events and so that the user is able to perform tasks in any order. For example, a user should be able to type text in a window, select a graphic and copy it, open a new document, paste in the graphic, open another document, and then go back to the first window to select text and change its typeface, size, or style.
 +
 +
Your application should respond to events in a way that lets the user switch between your application and others whenever the user chooses to do so (for example, by clicking in a window belonging to another application). Your application should also yield time to other applications when it isn't busy. System software provides a cooperative multitasking environment that allows users to switch between many open applications and that allows applications to receive available processing time when other applications aren't using the processor. System software coordinates the scheduling of processing time between your application and other applications.
 +
 +
You can also let your application communicate with other applications in order to request services or information from another application or to provide services to other applications. You can use the Event Manager or Apple Event Manager to do this.
 +
 +
===Menus===
 +
Menus are an important part of the design of a Macintosh application. Menus let users view or choose an item from a list of choices or commands that your application provides. You design your menus according to the tasks or actions your application performs. All applications should support the Apple, File, Edit, Help, Keyboard, and Application menus.
 +
 +
System software makes it easy for you to create pull-down, hierarchical, and pop-up menus. The chapter "Menu Manager" in this book describes how to create your application's menus, set up your menu bar, display menus, and respond to the user's choice of an item from a menu.
 +
 +
===Windows===
 +
Most applications interact with the user through windows.
 +
 +
[[File:IMT-SL-02.jpg]]
 +
 +
The user typically has one or more windows on the desktop, often from a number of different applications. Although the user can have multiple windows on the desktop, only one window is the active window. The active window is the window that appears frontmost on the desktop and is identified by racing stripes in its title bar.
 +
 +
All keyboard activity is directed toward the active window. You should make sure that your application follows the human interface guidelines regarding active and inactive windows. For example, you should show the scroll bars and highlight any selection in an active window belonging to your application; you should hide the scroll bars and remove highlighting from any selection in an inactive window belonging to your application. The menu bar of your application also should always reflect the state of your application's active window--that is, your application should enable only those menu commands that pertain to the active window.
 +
 +
You can use system software routines to assist you when your application needs to create, move, size, zoom, or update the contents of your window. The chapter "Window Manager" in this book describes how you can accomplish these tasks.
 +
 +
===Controls===
 +
Most windows and dialog boxes contain controls. Controls are onscreen objects that the user can manipulate with the mouse to cause an immediate action from your application or to change settings in order to modify a future action.
 +
 +
Buttons, checkboxes, radio buttons, pop-up menus, and scroll bars are examples of common controls used by most applications. Checkboxes, radio buttons, and pop-up menus are most often used in dialog boxes; buttons are most often used in alert boxes or dialog boxes; scroll bars are most often used in windows.
 +
 +
[[File:IMT-SL-05.jpg]]
 +
 +
A button appears as a rounded rectangle with a title centered inside. Use a button to perform an instantaneous action when the user clicks the button, such as completing operations defined by a dialog box or acknowledging an error message in an alert box.
 +
 +
A checkbox appears as a small square with a title beside it; the box contains an X when the setting associated with the box is on and is empty when the setting is off. Use a checkbox to indicate an option that must be either off or on.
 +
 +
A radio button appears as a circle with a title beside it; the circle contains a small black dot when the setting associated with the radio button is on and is empty when the setting is off. Radio buttons are similar to checkboxes in that they retain and display
 +
an on-or-off setting; however, only one radio button in a group of radio buttons should be on at any one time. You must decide how to group your radio buttons, and your application must ensure that only one radio button in a group is on.
 +
 +
A pop-up menu is a menu that appears in a dialog box or window. You can use pop-up menus as an alternative to radio buttons, to allow the user to select from a list of choices or settings.
 +
 +
A scroll bar appears as a light gray rectangle that has scroll arrows at each end of the rectangle. A window can have a horizontal scroll bar, a vertical scroll bar, or both. You can use scroll bars to let the user change the portion of a document that the user can view within a window.
 +
 +
You can track and respond to user actions in controls, redraw controls, and manipulate controls using Control Manager routines. You usually use the Dialog Manager to handle most controls in dialog boxes or alert boxes for you.
 +
 +
===Alert Boxes and Dialog Boxes===
 +
In addition to standard windows, your application typically also uses alert boxes and dialog boxes. An alert box is a window that your application displays on the screen to warn the user or to report an error to the user. An alert box typically consists of text describing the situation and buttons for the user to acknowledge or rectify the problem. Figure 1-4 shows an alert box that the SurfWriter application displays when the user attempts to close a window without saving the document. The alert box gives the user a chance to save the document before the SurfWriter application closes the window; this prevents the user from accidentally losing data.
 +
 +
[[File:IMT-SS-03.jpg]]
 +
 +
A dialog box is a window that you can use for the specific purpose of soliciting additional information from the user. The Dialog Manager provides routines to help you display dialog boxes and provides standard and consistent methods of interacting with the user. Dialog boxes can contain editable text items, informative or instructional text, and controls such as buttons and checkboxes. You can create modal, movable modal, or modeless dialog boxes.
 +
 +
[[File:IMT-SL-04.jpg]]
 +
 +
A modal dialog box is a dialog box that puts the user in the state or "mode" of being able to work only inside the dialog box. A modal dialog box is similar in appearance to an alert box, except that a modal dialog box can contain editable text items and additional controls, such as radio buttons and pop-up menus. The user cannot move a modal dialog box, and the user can dismiss a modal dialog box only by clicking its buttons. You should use a modal dialog box only when it's essential for the user to complete an operation before performing any other work.
 +
 +
A movable modal dialog box is a modal dialog box with a title bar (but no close box) that allows the user to move the dialog box. The user can dismiss the dialog box only by clicking its buttons; however, when you use movable modal dialog boxes, you should allow the user to switch to another application if the user clicks in the window of another application or chooses another application from the Apple or Application menu. Use a movable modal dialog box when the user might need to move the dialog box to view other areas of the screen or when the user can switch to another application without affecting the state of your application.
 +
 +
A modeless dialog box is a dialog box that looks like a document window without a size box or scroll bars. A modeless dialog box does not require the user to respond before doing anything else. The user can move a modeless dialog box, move between a modeless dialog box and other windows, and close a modeless dialog box just like a document window. Whenever possible, use a modeless dialog box instead of a movable modal or modal dialog box. Use a modeless dialog box when the user can perform other operations--such as working in document windows--without dismissing the modeless dialog box.
  
 
=See Also=
 
=See Also=

Revision as of 16:50, 25 September 2020

The Macintosh Toolbox is a collection of system software routines that your application can use to present a consistent and standard interface to the user; these routines also allow you to simplify other tasks your application might need to perform.

Macintosh system software contains a powerful set of routines that your application can use to create windows, manage menus, paint objects, display text, open files, share data between programs, and print files, as well as perform many other helpful tasks.

The Macintosh Toolbox encompasses a number of system software routines, most (but not all) of which help present your application’s interface to the user. Some of these routines include those provided by the Event Manager, Menu Manager, Window Manager, Control Manager, Dialog Manager, Help Manager, Resource Manager, and Scrap Manager.

Overview of the Macintosh Toolbox

Macintosh system software contains a powerful set of routines that your application can use to create windows, manage menus, paint objects, display text, open files, share data between programs, and print files, as well as perform many other helpful tasks.

The Macintosh Toolbox encompasses a number of system software routines, most (but not all) of which help present your application's interface to the user. Some of these routines include those provided by the Event Manager, Menu Manager, Window Manager, Control Manager, Dialog Manager, Help Manager, Resource Manager, and Scrap Manager.

You can directly call these routines from within your application. By using system software routines, you can take advantage of the many tasks they can perform for you, and you can concentrate on the parts of your application that are specific to your particular product.

Using the Macintosh Toolbox, you can

  • respond to user actions, such as mouse actions or keyboard input
  • create and display menus
  • create and display windows, alert boxes, and dialog boxes
  • create and display controls in windows, alert boxes, and dialog boxes
  • create icons for your application and its documents

Events

At the core of every Macintosh application is the application's event loop. The event loop is that piece of code in an application that processes and responds to user actions and other events. You can use the Event Manager to retrieve information about these actions. For example, you can get information that tells your application whether the user pressed a key or the mouse button, whether one of your application's windows needs updating as a result of the user moving windows, or whether some other hardware or software action requires a response from your application.

You should structure your application so that it can respond to events and so that the user is able to perform tasks in any order. For example, a user should be able to type text in a window, select a graphic and copy it, open a new document, paste in the graphic, open another document, and then go back to the first window to select text and change its typeface, size, or style.

Your application should respond to events in a way that lets the user switch between your application and others whenever the user chooses to do so (for example, by clicking in a window belonging to another application). Your application should also yield time to other applications when it isn't busy. System software provides a cooperative multitasking environment that allows users to switch between many open applications and that allows applications to receive available processing time when other applications aren't using the processor. System software coordinates the scheduling of processing time between your application and other applications.

You can also let your application communicate with other applications in order to request services or information from another application or to provide services to other applications. You can use the Event Manager or Apple Event Manager to do this.

Menus

Menus are an important part of the design of a Macintosh application. Menus let users view or choose an item from a list of choices or commands that your application provides. You design your menus according to the tasks or actions your application performs. All applications should support the Apple, File, Edit, Help, Keyboard, and Application menus.

System software makes it easy for you to create pull-down, hierarchical, and pop-up menus. The chapter "Menu Manager" in this book describes how to create your application's menus, set up your menu bar, display menus, and respond to the user's choice of an item from a menu.

Windows

Most applications interact with the user through windows.

IMT-SL-02.jpg

The user typically has one or more windows on the desktop, often from a number of different applications. Although the user can have multiple windows on the desktop, only one window is the active window. The active window is the window that appears frontmost on the desktop and is identified by racing stripes in its title bar.

All keyboard activity is directed toward the active window. You should make sure that your application follows the human interface guidelines regarding active and inactive windows. For example, you should show the scroll bars and highlight any selection in an active window belonging to your application; you should hide the scroll bars and remove highlighting from any selection in an inactive window belonging to your application. The menu bar of your application also should always reflect the state of your application's active window--that is, your application should enable only those menu commands that pertain to the active window.

You can use system software routines to assist you when your application needs to create, move, size, zoom, or update the contents of your window. The chapter "Window Manager" in this book describes how you can accomplish these tasks.

Controls

Most windows and dialog boxes contain controls. Controls are onscreen objects that the user can manipulate with the mouse to cause an immediate action from your application or to change settings in order to modify a future action.

Buttons, checkboxes, radio buttons, pop-up menus, and scroll bars are examples of common controls used by most applications. Checkboxes, radio buttons, and pop-up menus are most often used in dialog boxes; buttons are most often used in alert boxes or dialog boxes; scroll bars are most often used in windows.

IMT-SL-05.jpg

A button appears as a rounded rectangle with a title centered inside. Use a button to perform an instantaneous action when the user clicks the button, such as completing operations defined by a dialog box or acknowledging an error message in an alert box.

A checkbox appears as a small square with a title beside it; the box contains an X when the setting associated with the box is on and is empty when the setting is off. Use a checkbox to indicate an option that must be either off or on.

A radio button appears as a circle with a title beside it; the circle contains a small black dot when the setting associated with the radio button is on and is empty when the setting is off. Radio buttons are similar to checkboxes in that they retain and display an on-or-off setting; however, only one radio button in a group of radio buttons should be on at any one time. You must decide how to group your radio buttons, and your application must ensure that only one radio button in a group is on.

A pop-up menu is a menu that appears in a dialog box or window. You can use pop-up menus as an alternative to radio buttons, to allow the user to select from a list of choices or settings.

A scroll bar appears as a light gray rectangle that has scroll arrows at each end of the rectangle. A window can have a horizontal scroll bar, a vertical scroll bar, or both. You can use scroll bars to let the user change the portion of a document that the user can view within a window.

You can track and respond to user actions in controls, redraw controls, and manipulate controls using Control Manager routines. You usually use the Dialog Manager to handle most controls in dialog boxes or alert boxes for you.

Alert Boxes and Dialog Boxes

In addition to standard windows, your application typically also uses alert boxes and dialog boxes. An alert box is a window that your application displays on the screen to warn the user or to report an error to the user. An alert box typically consists of text describing the situation and buttons for the user to acknowledge or rectify the problem. Figure 1-4 shows an alert box that the SurfWriter application displays when the user attempts to close a window without saving the document. The alert box gives the user a chance to save the document before the SurfWriter application closes the window; this prevents the user from accidentally losing data.

IMT-SS-03.jpg

A dialog box is a window that you can use for the specific purpose of soliciting additional information from the user. The Dialog Manager provides routines to help you display dialog boxes and provides standard and consistent methods of interacting with the user. Dialog boxes can contain editable text items, informative or instructional text, and controls such as buttons and checkboxes. You can create modal, movable modal, or modeless dialog boxes.

IMT-SL-04.jpg

A modal dialog box is a dialog box that puts the user in the state or "mode" of being able to work only inside the dialog box. A modal dialog box is similar in appearance to an alert box, except that a modal dialog box can contain editable text items and additional controls, such as radio buttons and pop-up menus. The user cannot move a modal dialog box, and the user can dismiss a modal dialog box only by clicking its buttons. You should use a modal dialog box only when it's essential for the user to complete an operation before performing any other work.

A movable modal dialog box is a modal dialog box with a title bar (but no close box) that allows the user to move the dialog box. The user can dismiss the dialog box only by clicking its buttons; however, when you use movable modal dialog boxes, you should allow the user to switch to another application if the user clicks in the window of another application or chooses another application from the Apple or Application menu. Use a movable modal dialog box when the user might need to move the dialog box to view other areas of the screen or when the user can switch to another application without affecting the state of your application.

A modeless dialog box is a dialog box that looks like a document window without a size box or scroll bars. A modeless dialog box does not require the user to respond before doing anything else. The user can move a modeless dialog box, move between a modeless dialog box and other windows, and close a modeless dialog box just like a document window. Whenever possible, use a modeless dialog box instead of a movable modal or modal dialog box. Use a modeless dialog box when the user can perform other operations--such as working in document windows--without dismissing the modeless dialog box.

See Also