Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Recipe 10. Add a Preferences Window > Step 3: Configure the General Tab View It...

Step 3: Configure the General Tab View Item

The General tab view item contains two checkboxes controlling global application settings. One of them, when set to YES, suppresses the warning alert that is otherwise displayed any time the user attempts to scale a diary document larger than 100% for printing. The other, when set to YES, suppresses the warning alert that is otherwise displayed when the application restores an autosaved document. You already arranged to save these settings in the application’s user defaults in Recipes 7 and 9, but only when the user selects the suppression checkboxes in the two warning alerts where they are used. Once the user selects a suppression checkbox, there is no way to turn the warning alert back on because the alert is not displayed again. You must provide a separate user interface element to turn it back on, and the General pane of the preferences window is an appropriate place to do that. The user need only deselect the applicable checkbox in the General pane, and the alert will begin to appear again when appropriate.

When you originally set up the two suppression checkboxes in their alerts, you defined the keys under which they would be saved to the user defaults by using #define preprocessor macros. You defined the DEFAULT_ALERT_RESTORE_DIARY_DOCUMENT_SUPPRESSED_KEY key in the DiaryWindowController.m implementation file in Recipe 7, and you defined the DEFAULT_ALERT_PRINT_SCALED_UP_SUPPRESSED_KEY key in the DiaryPrintView.m implementation file in Recipe 9. These macros are local to the implementation files in which they are defined, so they cannot be used anywhere else. You have adopted a practice of setting up other keys for use with the user defaults by declaring external NSString variables in header files so that they are globally available to any other file that imports those header files. You will have to declare similar external variables for use with the two checkboxes in the General pane, after you set up the required accessor and action methods.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint