// Text of project Keys written on 11/22/95 at 11:59 AM // Beginning of file KeyFun myBase := {title: "KeyFun", viewBounds: {top: 0, left: 0, right: 240, bottom: 336}, viewSetupFormScript: func() begin constant kMaxWidth := 240; constant kMaxHeight := 336; local b := GetAppParams(); viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop, Min(b.appAreaWidth, kMaxWidth), Min(b.appAreaHeight, kMaxHeight) ); end, debug: "myBase", _proto: @157 }; _view000 := {text: "Toggle Keyboard", buttonClickScript: func() begin // if the keyboard is not open, set the current // key view to the paragraph view (paraView). // the key view is where the strings or characters // associated with a keypress will be sent/shown if not Visible(myKeyboard) then SetKeyView(paraView, StrLen(paraView.text)); myKeyboard:Toggle(); end, viewBounds: {left: 63, top: 17, right: 165, bottom: 39}, _proto: @226 }; AddStepForm(myBase, _view000); myKeyboard := {viewBounds: {left: 3, top: 49, right: 215, bottom: 149}, debug: "myKeyboard", _proto: @187 }; AddStepForm(myBase, myKeyboard); StepDeclare(myBase, myKeyboard, 'myKeyboard); // Before Script for "myKeypad" r := OpenResFileX(HOME & "Keys.rsrc"); DefConst('kPlanetPicture, GetPictAsBits("Planet", nil)); DefConst('kTardisPicture, GetPictAsBits("TARDIS", nil)); CloseResFileX(r); myKeypad := { keyDefinitions: [ [ keyVUnit, keyVUnit, kPlanetPicture, "Gallifrey ", keyHUnit + keyVUnit + keyFramed + keyAutoHilite + keyRoundingUnit*3, kTardisPicture, "TARDIS! ", keyHUnit + keyVUnit + keyFramed + keyAutoHilite + keyRoundingUnit*3, ], [ keyVUnit, keyVUnit, ["One ", "TWO! "], ["One ", "TWO! "], keyHUnit + keyVUnit + keyFramed + keyAutoHilite + keyRoundingUnit*3, func() begin if kDebugOn then print("inKeyLegend"); $b end, func() begin if kDebugOn then print("inKeyResult"); $b end, keyHUnit + keyVUnit + keyFramed + keyAutoHilite + keyRoundingUnit*3, ], ], viewBounds: {left: 4, top: 7, right: 204, bottom: 79}, keyArrayIndex: 0, toggleCharacter: func() begin hack := true; if (self.keyArrayIndex = 0) then SetValue(self, 'keyArrayIndex, 1); else SetValue(self, 'keyArrayIndex, 0); hack := nil; end, viewFormat: 0, hack: nil, keyPressScript: func(key) if key = $b then :toggleCharacter(); // note, this only works because of the non-nil newt_feature slot // which is new in Newton OS 2.0. It allows the keyPressScript to // run in addition to normal key handling. , newt_feature: TRUE; // notify the 2.0 OS that keyPressScript should be called // IN ADDITION to handling the key result in the normal way , debug: "myKeypad", _proto: @188 }; AddStepForm(myKeyboard, myKeypad); // After Script for "myKeypad" thisView := myKeypad; //Set the saveBounds to the viewBounds since this is probably what you want thisView.saveBounds := Clone(thisView.viewBounds); _view001 := {_proto: @166}; AddStepForm(myKeyboard, _view001); // After Script for "myKeyboard" thisView := myKeyboard; //Set the saveBounds to the viewBounds since this is probably what you want thisView.saveBounds := Clone(thisView.viewBounds); paraView := {viewFlags: 1, viewFormat: 12625, viewLineSpacing: 20, viewFont: 18434, viewBounds: {left: 11, top: 160, right: 233, bottom: 283}, text: "", debug: "paraView", viewClass: 81 }; AddStepForm(myBase, paraView); StepDeclare(myBase, paraView, 'paraView); constant |layout_KeyFun| := myBase; // End of file KeyFun