home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Proto Templates / PhoneExpando-1 / PhoneExpandoFun.text < prev    next >
Encoding:
Text File  |  1994-03-07  |  2.7 KB  |  105 lines  |  [TEXT/MPS ]

  1.  
  2. // ---- End Project Data ----
  3.  
  4.  
  5. // ---- File PhoneExpandoFun.t ----
  6.  
  7. // Before Script for "myBase"
  8. // Copyright © 1993-4 by Apple Computer, Inc.  All rights reserved.
  9.  
  10. myBase :=
  11.    {viewBounds: {top: 0, left: 0, right: 240, bottom: 336},
  12.     declareSelf: 'base,
  13.     title: "Phone Expando Test",
  14.     viewSetupFormScript:
  15.       func()
  16.       begin
  17.           local b := GetAppParams();
  18.           constant kMaxAppWidth := 240;
  19.           constant kMaxAppHeight := 336;
  20.           viewBounds := RelBounds(b.appAreaTop, b.appAreaLeft,
  21.               MIN(b.appAreaWidth, kMaxAppWidth), MIN(b.appAreaHeight, kMaxAppHeight));
  22.       end,
  23.     _proto: protoApp,
  24.     debug: "myBase"
  25.    };
  26.  
  27.  
  28. // Before Script for "myExpando"
  29. // Copyright © 1993-4 by Apple Computer, Inc.  All rights reserved.
  30.  
  31. myExpando := /* child of myBase */
  32.    {
  33.     viewSetupFormScript:
  34.       func()
  35.       begin
  36.           self.target := self;
  37.           self.lines := Clone(baseLines) ;
  38.       
  39.           phones := [] ;
  40.           AddArraySlot(phones, SetClass(Clone("800 555-1212"), 'workPhone));
  41.           AddArraySlot(phones, SetClass(Clone("408 555-1212"), 'homePhone));
  42.       
  43.            // add protos (based on protoPhoneExpando) to proto shell
  44.           :AddItem({_proto: pt_myPhoneExpando});
  45.           :AddItem({_proto: pt_myPhoneExpando, phoneIndex: 1});
  46.       end,
  47.     flushEdits:
  48.       func()
  49.       begin
  50.           // don't need to do anything to save, just a demo!
  51.           nil
  52.       end,
  53.     lines: nil,
  54.     numlines: 2,
  55.     editWidth: 200,
  56.     editHeight: 50,
  57.     deleteThis: "delete",
  58.     viewBounds: {top: 24, left: 8, right: 232, bottom: 296},
  59.     baseLines:
  60.       // just some defaults, from protoExpandoShell...
  61.       
  62.       [{_proto: protoTextExpando,
  63.           label: "Override",
  64.           path: 'deleteThis,
  65.           entryFlags: (1 << 0)  + (65535 << 9)},
  66.           {_proto: protoTextExpando,
  67.           label: "These",
  68.           path: 'deleteThis,
  69.           entryFlags: (1 << 0)  + (65535 << 9)}],
  70.     phones: nil,
  71.     AddItem:
  72.       func(theItemProto)
  73.       begin
  74.           AddArraySlot(lines, Clone(theItemProto));
  75.           numLines := numLines + 1;
  76.       
  77.           // if the view is displayed, then update the children
  78.           if GetView(self) then
  79.               :RedoChildren();
  80.       end,
  81.     _proto: protoExpandoShell,
  82.     debug: "myExpando"
  83.    };
  84. // View myExpando is declared to myBase
  85.  
  86.  
  87.  
  88.  
  89. // ---- Beginning of non-used User Protos ----
  90.  
  91. // ---- File myPhoneExpando ----
  92.  
  93. // Before Script for "_userproto000"
  94. // Copyright © 1993-4 by Apple Computer, Inc.  All rights reserved.
  95.  
  96. _userproto000 := {phoneIndex: 0, path: 'phones, _proto: protoPhoneExpando};
  97.  
  98.  
  99. // ---- End of non-used User Protos ----
  100.  
  101.  
  102.  
  103. // ---- Beginning of section for non used Layout files ----
  104.  
  105. // End of output