// Text of project TextList written on 5/9/95 at 3:29 PM // Beginning of file main.t // Before Script for "baseView" /* ** Newton Developer Technical Support Sample Code ** ** TextList, Shows the basics of the protoTextList proto ** ** by Kent Sandvik, Newton Developer Technical Support ** ** Copyright © 1993-1995 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ baseView := {title: "TextList", viewBounds: {left: 0, top: 0, right: 240, bottom: 336}, viewSetupFormScript: func() begin local b := GetAppParams(); constant kMaxWidth := 240; constant kMaxHeight := 336; viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop, Min(b.appAreaWidth, kMaxWidth), Min(b.appAreaHeight, kMaxHeight) ); end, debug: "baseView", _proto: @157 }; Info := {viewBounds: {left: 10, top: 26, right: 218, bottom: 74}, viewJustify: 0, text: "This is an example of how to use the protoTextList. In this case we will list all the available printer types and select one of them." , debug: "Info", _proto: @218 }; AddStepForm(baseView, Info); theList := {viewBounds: {left: 27, top: 115, right: 201, bottom: 193}, viewSetupFormScript: func() begin listItems := Array(length(AvailablePrinters), nil); // create the array in RAM // get a list of available printers and place these in the listitem array foreach index, value in AvailablePrinters do begin listItems[index] := value.name; end; :SetupList(); end, viewFont: simpleFont9, viewLines: 6, buttonClickScript: func(textIndex) begin print("Selected the following index =" &&textIndex); // now set the result field as well, and open/close to show the viewEffect theResult:Close(); SetValue(theResult, 'text, listItems[textIndex]); theResult:Open(); end, listItems: nil, viewJustify: 0, debug: "theList", _proto: @228 }; AddStepForm(baseView, theList); ResultLabel := {text: "You selected:", viewBounds: {left: 26, top: 210, right: 202, bottom: 234}, debug: "ResultLabel", _proto: @218 }; AddStepForm(baseView, ResultLabel); theResult := {text: "Nothing selected yet\u2026", viewBounds: {left: 26, top: 250, right: 202, bottom: 282}, viewFormat: 304, viewEffect: 44435456, debug: "theResult", _proto: @218 }; AddStepForm(baseView, theResult); StepDeclare(baseView, theResult, 'theResult); constant |layout_main.t| := baseView; // End of file main.t