// Text of project Party Time written on 4/23/97 at 2:40 PM // Beginning of file Party Time slip // Before Script for "base" // Copyright © 1997 by Apple Computer, Inc. All rights reserved. base := {viewBounds: {left: -1, top: 10, right: 215, bottom: 298}, viewSetupChildrenScript: func() // this function initializes the children view's information from the soupEntry. begin local theTime; title.text := clone(soupEntry.mtgText); // remove the hour & minute information because the datePicker doesn't want it theTime := Date(soupEntry.mtgStartDate); theTime.hour := 0; theTime.minute := 0; datePicker.date := totalMinutes(theTime); // find out the duration timePicker.startTime := soupEntry.mtgStartDate; timePicker.stopTime := soupEntry.mtgStartDate + soupEntry.mtgDuration; // set the checkboxes for food and then drink foreach i, sym in '[food1, food2, food3, food4] do if length(soupEntry.foodArr) > i then self.(sym).viewValue := soupEntry.foodArr[i]; foreach i, sym in '[drink1, drink2, drink3, drink4] do if length(soupEntry.drinkArr) > i then self.(sym).viewValue := soupEntry.drinkArr[i]; end, soupEntry: nil // this is set by NewMeeting or OpenMeeting when it opens us. , viewQuitScript: // must return the value of inherited:?viewQuitScript(); func() begin local theTime; soupEntry.mtgText := clone(title.text); // figure out the starting time, by combining the data from datePicker and timePicker. theTime := Date(timePicker.startTime); soupEntry.mtgStartDate := datePicker.date + (theTime.hour * 60) + theTime.minute; // find out the duration soupEntry.mtgDuration := timePicker.stopTime - timePicker.startTime; // set other data fields soupEntry.repeatPeriod := nil; soupEntry.foodArr := [food1.viewValue, food2.viewValue, food3.viewValue, food4.viewValue]; soupEntry.drinkArr := [drink1.viewValue, drink2.viewValue, drink3.viewValue, drink4.viewValue]; // Save the changed soup entry EntryChangeXmit(soupEntry, kAppSymbol); inherited:?viewQuitScript(); // this method is defined internally end, bigicon: GetPictAsBits("bigIcon", 1), smallIcon: GetPictAsBits("TitleIcon", 1), debug: "base", _proto: @179 }; _view000 := {title: "Party", viewBounds: {left: -8, top: 0, right: 56, bottom: 16}, titleIcon: GetPictAsBits("TitleIcon", 1), _proto: @229 }; AddStepForm(base, _view000); _view001 := {text: "Name or Excuse", viewBounds: {left: 5, top: 30, right: 53, bottom: 62}, viewJustify: 0, _proto: @218 }; AddStepForm(base, _view001); title := {viewBounds: {left: 52, top: 22, right: 215, bottom: 62}, debug: "title", _proto: @185 }; AddStepForm(base, title); StepDeclare(base, title, 'title); datePicker := {viewBounds: {left: 5, top: 1, right: 3, bottom: 19}, label: kPopChar & "Date", Date: 0, debug: "datePicker", _proto: @629 }; AddStepForm(base, datePicker); StepDeclare(base, datePicker, 'datePicker); timePicker := {viewBounds: {left: 5, top: 0, right: 3, bottom: 18}, label: kPopChar & "Time", startTime: 0, stopTime: 0, debug: "timePicker", _proto: @628 }; AddStepForm(base, timePicker); StepDeclare(base, timePicker, 'timePicker); _view002 := {text: "Food", viewBounds: {left: 5, top: 100, right: 77, bottom: 114}, _proto: @218 }; AddStepForm(base, _view002); food1 := {text: "Vegetables & dip", viewBounds: {left: 16, top: 113, right: 152, bottom: 127}, viewValue: nil, debug: "food1", _proto: @164 }; AddStepForm(base, food1); StepDeclare(base, food1, 'food1); food2 := {text: "Chips and salsa", viewBounds: {left: 16, top: 126, right: 152, bottom: 140}, viewValue: nil, debug: "food2", _proto: @164 }; AddStepForm(base, food2); StepDeclare(base, food2, 'food2); food3 := {text: "Pizza", viewBounds: {left: 16, top: 139, right: 152, bottom: 153}, viewValue: nil, debug: "food3", _proto: @164 }; AddStepForm(base, food3); StepDeclare(base, food3, 'food3); food4 := {text: "Smoked Salmon", viewBounds: {left: 16, top: 152, right: 152, bottom: 166}, viewValue: nil, debug: "food4", _proto: @164 }; AddStepForm(base, food4); StepDeclare(base, food4, 'food4); _view003 := {text: "Drink", viewBounds: {left: 7, top: 188, right: 79, bottom: 202}, _proto: @218 }; AddStepForm(base, _view003); drink1 := {text: "Soda", viewBounds: {left: 20, top: 201, right: 156, bottom: 215}, viewValue: nil, debug: "drink1", _proto: @164 }; AddStepForm(base, drink1); StepDeclare(base, drink1, 'drink1); drink2 := {text: "Beer", viewBounds: {left: 20, top: 214, right: 156, bottom: 228}, viewValue: nil, debug: "drink2", _proto: @164 }; AddStepForm(base, drink2); StepDeclare(base, drink2, 'drink2); drink3 := {text: "Wine", viewBounds: {left: 20, top: 227, right: 156, bottom: 241}, viewValue: nil, debug: "drink3", _proto: @164 }; AddStepForm(base, drink3); StepDeclare(base, drink3, 'drink3); drink4 := {text: "Champagne", viewBounds: {left: 20, top: 240, right: 156, bottom: 254}, viewValue: nil, debug: "drink4", _proto: @164 }; AddStepForm(base, drink4); StepDeclare(base, drink4, 'drink4); _view004 := { buttonClickScript: func() begin // inherited:?buttonClickScript(); // this method is defined internally // don't do the normal closing behavior; we want to call RememberedClose() and Dates will do the rest. GetRoot().calendar:RememberedClose(base); end, _proto: @163 }; AddStepForm(base, _view004); constant |layout_Party Time slip| := base; // End of file Party Time slip // Beginning of text file Party Time scripts // Party Time scripts // Copyright © 1997 by Apple Computer, Inc. All rights reserved. installscript := func(pf, removeFrame) begin local t:=GetLayout("Party Time Slip"); // this is the view template used below if GetRoot().calendar then GetRoot().calendar:RegMeetingType(kAppSymbol, {item: "Party", icon: t.bigicon, smallicon: t.smallicon, NewMeeting: func(date, parentBox) begin // Use the Dates API to create the new meeting soup entry. // Default to starting at the current time and going for 2 hours (120 minutes) local soupEntry := getroot().calendar:AddAppointment("", date, 120, nil, nil); // say that it's our special type of meeting soupEntry.meetingType := kAppSymbol; // provide defaults for the slip's checkboxes soupEntry.drinkArr := [true, true, nil, nil]; soupEntry.foodArr := [true, true, true, nil]; // open the slip local theView := {_proto: t, soupEntry: soupEntry}; GetRoot().calendar:RememberedOpen(BuildContext(theView)); nil; end, OpenMeeting: func(soupEntry, date, parentBox) begin local theView := {_proto: t, soupEntry: soupEntry}; GetRoot().calendar:RememberedOpen(BuildContext(theView)); nil; end, }); end; RemoveScript:=func(removeFrame) begin if GetRoot().calendar then GetRoot().calendar:UnRegMeetingType(kAppSymbol); end; // End of text file Party Time scripts