// ---- End Project Data ---- // ---- 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, _proto: protoApp, debug: "myBase" }; _view000 := /* child of myBase */ {text: "Name", viewBounds: {left: 10, top: 42, right: 58, bottom: 58}, _proto: protoStaticText }; _view001 := /* child of myBase */ {text: "Address", viewBounds: {left: 10, top: 66, right: 58, bottom: 82}, _proto: protoStaticText }; theName := /* child of myBase */ {text: "Static Text", viewBounds: {left: 66, top: 42, right: 218, bottom: 58}, _proto: protoStaticText, debug: "theName" }; // View theName is declared to myBase theAddress := /* child of myBase */ {text: "Static Text", viewBounds: {left: 66, top: 66, right: 218, bottom: 106}, _proto: protoStaticText, debug: "theAddress" }; // View theAddress is declared to myBase // ---- Beginning of section for non used Layout files ---- // End of output