Making an Existing Application Stationery-Based

Change the Application to Take Advantage of the Stationery

11. To add a new button to the status bar, modify the menuLeftButtons of the newtStatusBar to:

[
   newtInfoButton,
   GetLayout("sortButton.t"),
   newtNewStationeryButton,
]
12. In order to ensure that the correct dataDefs appear in New, we need to add a superSymbol slot to the base template (the newtApplication). Set its value to:

kSuperSymbol
Now, make sure that new items created automatically are of the appropriate dataDef type. We do that by modifying the allSoups slot of the newtApplication template to add a defaultDataDef slot. We also need to edit the CreateBlankEntry slot in allSoups so it no longer initializes the price slot. (We still need to initialize the remaining slots since they are application-specific--we have indexes on them.)

13. Here is the newly modified allSoups slot:

{
   mySoup: {
      _proto: newtSoup,
      soupName: "Bookstore:Calliope",
      soupIndices: [
         {
            structure: 'slot,
            path: 'author,
            type: 'string,
         },
         {
            structure: 'slot,
            path: 'title,
            type: 'string,
         },
         {
            structure: 'slot,
            path: 'acquireDate,
            type: 'int,
         },
         {
            structure: 'slot,
            path: 'numberInStock,
            type: 'int,
         },
      ],
      defaultDataType: kBookDataDefSym,
      soupQuery: {indexPath: 'author},
      CreateBlankEntry: func()
      begin
         return {
            author: "",
            title: "",
            acquireDate: Time(), // today!
            numberInStock: 1,
         };
      end,
   },
}
14. Since the overview text will be coming from the dataDef, there is no need for the OverviewAbstract method of the newtOverLayout template; remove it.

15. In "Default.t", make sure there are no children of the newtEntryView. Draw a newtStationeryView as a child of the newtEntryView and set its viewBounds slots to 0 and its viewJustify to parentRelativeFull horizontally and vertically. This is where the appropriate viewDef will be placed.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996