//this constant may be defined in a future version of NTK //but we are including currently constant kLettersDictionary := 33; // ---- End Project Data ---- // ---- File Letter.t ---- // Before Script for "Single Letter Example" //Copyright 1993-1994 Apple Computer. All rights reserved. Single Letter Example := {title: "Single Letters", viewBounds: {left: 0, top: 18, right: 203, bottom: 309}, viewEffect: 986145, _proto: protoApp, debug: "Single Letter Example" }; usesDictionary := /* child of Single Letter Example */ {viewBounds: {left: 16, top: 40, right: 184, bottom: 88}, dictionaries: [kLettersDictionary]; // uses the built-in single letter dictionary, viewFlags: 25168385, textflags: vNoSpaces, _proto: protoInputLine, debug: "usesDictionary" }; _view000 := /* child of Single Letter Example */ {text: "Uses custom dictionary", viewBounds: {left: 18, top: 82, right: 154, bottom: 98}, viewFont: simpleFont9, _proto: protoStaticText }; generic := /* child of Single Letter Example */ {viewBounds: {left: 16, top: 184, right: 184, bottom: 232}, viewFlags: 8407809, textflags: vNoSpaces, _proto: protoInputLine, debug: "generic" }; _view001 := /* child of Single Letter Example */ {text: "Uses \"vLettersAllowed\" flag", viewBounds: {left: 18, top: 226, right: 162, bottom: 242}, viewFont: simpleFont9, _proto: protoStaticText }; totallyCustom := /* child of Single Letter Example */ {viewBounds: {left: 16, top: 112, right: 184, bottom: 160}, dictionaries: [kLettersDictionary];, viewFlags: 25168385, textflags: vNoSpaces, viewFormat: 337, viewWordScript: // This code very naively assumes that only A-Z characters are valid letters // Do not use code like this if you want to work on non-American Newton systems. DefConst('kOrdA, ord($A)); DefConst('kOrdZ, ord($Z)); DefConst('kDefLetter, "A"); func(unit) begin local candidate; local cOrd; local list := GetWordArray(unit); print(list); foreach word in list do begin print(isalphanumeric(word[0])); cOrd := ord(word[0]); if cOrd >= kOrdA and cOrd <= kOrdZ and word[0] <> letter then begin candidate := word; break; end; end; if not candidate then candidate := letter & ""; theShape := MakeText(candidate, 0, 0, width, baseline); letter := candidate[0]; :Dirty(); TRUE; //This should return TRUE if you handled the word end , viewSetupDoneScript: func() begin self.baseline := :LocalBox().bottom DIV 2 + 9; self.width := :LocalBox().right; end, baseline: nil, theShape: nil, viewDrawScript: DefConst('kCentered18ptStyle, {font: fancyFont18, justification: 'center}); func() begin if theShape then :DrawShape(theShape, kCentered18ptStyle); end, width: nil, letter: nil, viewClickScript: func(unit) begin theShape := nil; :Dirty(); RefreshViews(); NIL; end, viewclass: 74, debug: "totallyCustom" }; _view002 := /* child of Single Letter Example */ {text: "Totally custom", viewBounds: {left: 16, top: 160, right: 160, bottom: 176}, viewFont: simpleFont9, _proto: protoStaticText }; // ---- Beginning of section for non used Layout files ---- // End of output