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 / Utility Functions / LondonCalling-2 / call.text < prev    next >
Encoding:
Text File  |  1994-02-28  |  3.7 KB  |  157 lines  |  [TEXT/MPS ]

  1. // Copyright © 1993-94 Apple Computer, Inc. All rights reserved.
  2.  
  3. constant kAppSymbol := '|LondonCalling:PIEDTS|;
  4.  
  5. // ---- End Project Data ----
  6.  
  7.  
  8. // ---- File main.t ----
  9. myBase :=
  10.    {viewBounds: {left: -1, top: 26, right: 219, bottom: 293},
  11.     viewScrollDownScript:
  12.       func()
  13.       begin
  14.          CountryList:viewScrollDownScript();
  15.       end,
  16.     viewScrollUpScript:
  17.       func()
  18.       begin
  19.          CountryList:viewScrollUpScript();
  20.       end,
  21.     title: "London Calling",
  22.     UpdatePhone:
  23.       func()
  24.       begin
  25.          // get the country name from the countryList view
  26.          local cl := countryList ;
  27.          local cName := cl.listItems[cl.selection] ;
  28.       
  29.          // set the value of the convertedText static text
  30.          // item to the output from MungePhone.
  31.          SetValue(convertedText, 'text,
  32.             :MungePhone(phoneLine.entryLine.text, cName);
  33.             );
  34.       end,
  35.     _proto: protoApp,
  36.     debug: "myBase"
  37.    };
  38.  
  39. convertedText := /* child of myBase */
  40.    {text: "",
  41.     viewBounds: {left: 7, top: 166, right: 215, bottom: 214},
  42.     viewFormat: 337,
  43.     _proto: protoStaticText,
  44.     debug: "convertedText"
  45.    };
  46. // View convertedText is declared to myBase
  47.  
  48.  
  49.  
  50. _view000 := /* child of myBase */
  51.    {text: "Converted Number",
  52.     viewBounds: {left: 6, top: 150, right: 110, bottom: 166},
  53.     _proto: protoStaticText
  54.    };
  55.  
  56.  
  57.  
  58. phoneLine := /* child of myBase */
  59.    {viewBounds: {left: 3, top: 21, right: 221, bottom: 45},
  60.     label: "Phone:",
  61.     text: "415 555 1212",
  62.     entryFlags: 273921,
  63.     labelCommands: ["408 555 1212", "415 555 1212", "81 555 1212"],
  64.     _proto: protoLabelInputLine,
  65.     debug: "phoneLine"
  66.    };
  67. // View phoneLine is declared to myBase
  68.  
  69.  
  70.  
  71. CountryList := /* child of myBase */
  72.    {viewBounds: {left: 67, top: 51, right: 218, bottom: 145},
  73.     viewSetupFormScript:
  74.       func()
  75.       begin
  76.          // get an array of all the countries that Newton
  77.          // can convert phone numbers for
  78.          c := 
  79.             foreach item in ROM_countries collect item.name ;
  80.       
  81.          // sort that array alphabetically
  82.          c := Sort(c, '|str<|, nil);
  83.       
  84.          // and set the list items to that array
  85.          self.listItems := c ;
  86.       
  87.          // setup the list
  88.          :SetupList();
  89.       end,
  90.     viewFont: ROM_fontSystem9,
  91.     viewLines: 7,
  92.     viewSetupDoneScript:
  93.       func()
  94.       begin
  95.          // set the default selection to the line containing USA
  96.          // make sure it is visible by scrolling down to it
  97.          usaLine := ArrayPos(listItems, "USA", 0, func(a,b) StrEqual(a,b)) ;
  98.          :DoScrollScript(MIN(usaLine * lineHeight, spillHeight)) ;
  99.          selection := usaLine;
  100.       end,
  101.     _proto: protoTextList,
  102.     debug: "CountryList"
  103.    };
  104. // View CountryList is declared to myBase
  105.  
  106.  
  107.  
  108. _view001 := /* child of myBase */
  109.    {text: "Country of Phone Number",
  110.     viewBounds: {left: 6, top: 50, right: 65, bottom: 112},
  111.     viewJustify: 0,
  112.     _proto: protoStaticText
  113.    };
  114.  
  115.  
  116.  
  117. Convert := /* child of myBase */
  118.    {text: "Convert Phone",
  119.     buttonClickScript:
  120.       func()
  121.       begin
  122.          :UpdatePhone();
  123.       end,
  124.     viewBounds: {left: 11, top: 226, right: 95, bottom: 238},
  125.     _proto: protoTextButton,
  126.     debug: "Convert"
  127.    };
  128.  
  129.  
  130.  
  131. Options := /* child of myBase */
  132.    {text: "Options",
  133.     buttonClickScript:
  134.       func()
  135.       begin
  136.          // set the invoker of the callOptionsSlip to be
  137.          // the base view
  138.          // NOTE: invoker must support the message UpdatePhone
  139.          callOptionsSlip.invoker := base;
  140.       
  141.          // then open it
  142.          callOptionsSlip:Toggle();
  143.       end,
  144.     viewBounds: {left: 115, top: 226, right: 183, bottom: 238},
  145.     _proto: protoTextButton,
  146.     debug: "Options"
  147.    };
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155. // ---- Beginning of section for non used Layout files ----
  156.  
  157. // End of output