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 / Recognition / WordArray-1 / WordArray.text < prev    next >
Encoding:
Text File  |  1994-07-07  |  2.1 KB  |  87 lines  |  [TEXT/MPS ]

  1.  
  2. // ---- End Project Data ----
  3.  
  4.  
  5. // ---- File main.t ----
  6.  
  7. // Before Script for "_view000"
  8. // Copyright 1993-1994 Apple Computer, Inc. All rights reserved.
  9.  
  10. _view000 :=
  11.    {title: "WordArray",
  12.     viewBounds: {left: 0, top: 2, right: 236, bottom: 326},
  13.     viewFormat: 83951953
  14.     ,
  15.     viewSetupFormScript:
  16.       func()
  17.       begin
  18.       local b := GetAppParams();
  19.       constant kMaxWidth := 240;
  20.       constant kMaxHeight := 336;
  21.       
  22.       viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
  23.               Min(b.appAreaWidth, kMaxWidth),
  24.               Min(b.appAreaHeight, kMaxHeight) );
  25.       end,
  26.     _proto: protoApp
  27.    };
  28.  
  29. _view001 := /* child of _view000 */
  30.    {viewFlags: 114177,
  31.     viewFormat: nil,
  32.     viewBounds: {left: 0, top: 72, right: 240, bottom: 304},
  33.     viewWordScript:
  34.       func(unit)
  35.       begin
  36.           ourWords := GetWordArray(unit);        // list of likely words
  37.           ourScores := GetScoreArray(unit);    // list of 'confidence' scores
  38.       
  39.           print("a word was recognized!");
  40.       
  41.           :Dirty();    // clear our view and eventually redraw our new words 
  42.       
  43.       true;    //This should return TRUE if you handled the word
  44.       end,
  45.     ourWords: nil,
  46.     viewDrawScript:
  47.       func()
  48.       begin
  49.       local item, index;
  50.       local vertical := 20;
  51.       
  52.       if ourWords then
  53.       
  54.           foreach index, item in ourWords do
  55.               begin
  56.               :DrawShape(MakeText(item && ":  " && ourScores[index], 10, vertical, 200, vertical + 20), nil);
  57.               vertical := vertical + 20;
  58.               end;
  59.       
  60.       end,
  61.     ourScores: nil,
  62.     viewclass: 74
  63.    };
  64.  
  65.  
  66.  
  67. _view002 := /* child of _view000 */
  68.    {viewFlags: 1,
  69.     viewFormat: 257,
  70.     viewlinespacing: 10,
  71.     viewFont: simpleFont9,
  72.     viewBounds: {left: 24, top: 24, right: 216, bottom: 72},
  73.     text:
  74.       "Write somewhere below this text. In the viewWordScript, the GetWordArray() and GetScoresArray() functions retrieve the recognition information: words and their 'confidence scores' (lower is better)"
  75.     ,
  76.     viewclass: 81
  77.    };
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. // ---- Beginning of section for non used Layout files ----
  86.  
  87. // End of output