// Text of project SoupShowSimple written on 5/13/95 at 11:25 PM // Beginning of file SoupShowSimple.t // Before Script for "myBase" // Copyright 1993-1994 Apple Computer, Inc. All rights reserved. myBase := {title: "Application", viewBounds: {left: 0, top: 0, right: 240, bottom: 336}, viewSetupFormScript: func() begin // readjust the size of the application to the screen // make it no bigger than a MessagePad a := GetAppParams(); viewBounds := RelBounds(a.AppAreaLeft, a.AppAreaTop, MIN(a.AppAreaWidth, 240), MIN(a.AppAreaHeight, 336)); // now get the information that the app will display // first get a reference to the right soup // NOTE: this is usually where you would do a // :RegisterCardSoup call cardSoup := GetUnionSoup(ROM_cardfilesoupname); // now get a cursor to that data so it can be // displayed. myCursor := Query(cardSoup, {type: 'index}) ; // now display some initial entry :DisplayFromSoup(); end, cardSoup: nil, myCursor: nil, DisplayFromSoup: // this function will display the data from the // current cursor entry, i.e., whatever myCursor // is pointing to. func() begin local nameEntry := myCursor:Entry() ; // may not be an entry so be careful if nameEntry then begin local temp ; temp := nameEntry.name.honorific ; if temp then temp := temp && nameEntry.name.first && nameEntry.name.last ; else temp := nameEntry.name.first && nameEntry.name.last ; SetValue(theName, 'text, temp) ; temp := nameEntry.Address ; if nameEntry.Address2 then temp := temp & "\n" & nameEntry.Address2 ; SetValue(theAddress, 'text, temp) ; end else begin SetValue(theName, 'text, "") ; SetValue(theAddress, 'text, "") ; end; end, viewScrollUpScript: func() begin // the universal scroll up arrow. Want to move to // the previous entry in the names file // however, may be no next item, in that case // beep and go to the end (or try to). if not myCursor:Prev() then begin :SysBeep(); // THIS IS A BAD WAY TO DO THIS!!! // you should really use a key value that is bigger than // the largest possible key value. myCursor:Move(9999999); myCursor:Prev() end; // now update the display :DisplayFromSoup() ; end, viewScrollDownScript: func() begin // the universal scroll down arrow. Want to move to // the next entry in the names file // however, may be no next item, in that case // beep and reset. if not myCursor:Next() then begin :SysBeep(); myCursor:Reset(); end; // now update the display :DisplayFromSoup() ; end, viewQuitScript: func() begin // cleanup after myself cardSoup := nil ; myCursor := nil ; end, debug: "myBase", _proto: @157 }; _view000 := {text: "Name", viewBounds: {left: 10, top: 42, right: 58, bottom: 58}, _proto: @218 }; AddStepForm(myBase, _view000); _view001 := {text: "Address", viewBounds: {left: 10, top: 66, right: 58, bottom: 82}, _proto: @218 }; AddStepForm(myBase, _view001); theName := {text: "Static Text", viewBounds: {left: 66, top: 42, right: 218, bottom: 58}, debug: "theName", _proto: @218 }; AddStepForm(myBase, theName); StepDeclare(myBase, theName, 'theName); theAddress := {text: "Static Text", viewBounds: {left: 66, top: 66, right: 218, bottom: 106}, debug: "theAddress", _proto: @218 }; AddStepForm(myBase, theAddress); StepDeclare(myBase, theAddress, 'theAddress); constant |layout_SoupShowSimple.t| := myBase; // End of file SoupShowSimple.t