// Copyright © 1993-94 Apple Computer, Inc. All rights reserved. constant kAppName := '|PICT1:PIEDTS|; // ---- End Project Data ---- // ---- File main.t ---- myBase := {title: "Application", viewBounds: {top: 8, left: 0, right: 224, bottom: 324}, alarmPict: GetPictAsBits("alarm clock", 1), lightPict: GetPictAsBits("light bulb", 1), planePict: GetPictAsBits("plane", nil), scalesPict: GetPictAsBits("scales", nil), _proto: protoApp, debug: "myBase" }; pictureButton := /* child of myBase */ {viewBounds: {left: 76, top: 108, right: 136, bottom: 160}, buttonClickScript: func() begin end, currentPictIndex: 0, pictArray: nil, viewSetupFormScript: func() begin // setup my picture array pictArray := [alarmPict, lightPict, planePict, scalesPict]; // set my icon to the one of the elements in the array // use the currentPictIndex to decide which element // that is. Use my changePicture script to set things up :changePicture(currentPictIndex) ; end, changePicture: func(pictIndex) begin // this function will set the icon of this button // to some picture from its array of pictures. // the pictIndex argument is either an index // to the array, or nil. If nil, set the picture // to the next picture in the array. if pictIndex then // should really error check this value currentPictIndex := pictIndex ; else // set my picture to the next one in the array // make sure index is valid by wrapping it around currentPictIndex := (currentPictIndex + 1) MOD length(pictArray) ; // now set my icon to the new one SetValue(self, 'icon, pictArray[currentPictIndex]) ; end, _proto: protoPictureButton, debug: "pictureButton" }; // View pictureButton is declared to myBase _view000 := /* child of myBase */ {text: "Change the Picture", buttonClickScript: func() begin pictureButton:changePicture(nil); end, viewBounds: {left: 42, top: 194, right: 154, bottom: 218}, _proto: protoTextButton }; // ---- Beginning of section for non used Layout files ---- // End of output