#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" altAnswerDateHarness1N  UTahoma UtahomaUTahoma cREVGeneral @N Pick DateEpon mouseUp put "2006" into tYear put "8" into tMonth put "12" into tDay start using stack "calendarWidget100" get altAnswerDate(tYear,tMonth,tDay) stop using stack "calendarWidget100" if it is empty then exit mouseUp put it into fld 1 end mouseUp ;R cREVGeneral revUniqueID 1154780774494 Field)`d cREVGeneral revUniqueID 1154780876902  2006,8,10,5  description p7on linkClicked pLink revGoURL pLink end linkClicked  b cREVTable currentview

altAnswerDate

This is a free wrapper for Shao Sean'sfine calendarWidget which can be called simply like an answer dialog box. (Thanks again Shao for a great tool!!!!)

To use this stack, make the stack "calendarWidget100" a substack of your main stack. Then when you need to prompt the user for a date, you can put the following into a button script (like the one below):

on mouseUp

put "2006" into tYear

put "8" into tMonth

put "12" into tDay

start using stack "calendarWidget100"

get altAnswerDate(tYear,tMonth,tDay)

stop using stack "calendarWidget100"

if it is empty then exit mouseUp

put it into fld 1

end mouseUp

Note: If you like, you can insert the start using and stop using statements in your startup routine. This will keep the stack loaded in memory. Also, note you can force the calendar to open to a specific date. If you want it to open to today's date, then put "" into tYear, tMonth and tDay.

 cREVGeneral revUniqueID 1154785407631 altAnswerDate  This is a free wrapper for Shao Sean'sfine calendarWidget which can be called simply like an answer dialog box. (Thanks again Shao for a great tool!!!!) To use this stack, make the stack "calendarWidget100" a substack of your main stack. Then when you need to prompt the user for a date, you can put the following into a button script (like the one below): on mouseUp @   put "2006" into tYear  @   put "8" into tMonth  @   put "12" into tDay  @  ( start using stack "calendarWidget100" @  ' get altAnswerDate(tYear,tMonth,tDay)  @  @ ' stop using stack "calendarWidget100"  @  # if it is empty then exit mouseUp  @  @  @   put it into fld 1  @  end mouseUp @  #Note: If you like, you can insert the start using and stop using statements in your startup routine. This will keep the stack loaded in memory. Also, note you can force the calendar to open to a specific date. If you want it to open to today's date, then put "" into tYear, tMonth and tDay. `@`  description P7on linkClicked pLink revGoURL pLink end linkClicked 7 B cREVGeneral revUniqueID 1154785712289 "returns 4 comma-delimitted items: mitem 1 is year, item 2 is month, item 3 is date, item 4 is day of the week (1 is Sunday, 2 is Monday, etc..)calendarWidget100 function altAnswerDate pYear,pMonth,pDate put the name of me into tStack --> SET UP show me set the uYear of group "calendarWidget" of tStack to pYear set the uMonth of group "calendarWidget" of tStack to pMonth set the uDate of group "calendarWidget" of tStack to pDate send "calendarWidgetDraw" to group "calendarWidget" of tStack in 30 millisecs modal me return the dialogdata end altAnswerDate on stripAndShip put "" into fld "log" of me end stripAndShip uDay2Choose a date ULucida Grande Uusesystemfont ULucida Grande WLucida Grande ULucida Grande WLucida Grande @ULucida Grande UTahoma UTahoma cREVGeneralcREVGeometryCachestackID1046p  cREVGeneralcREVGeometryCacheIDs1153549409546101411547811353361046115357027884610281153570234891102611535600000511021115357018991210251154781100540104511535703008581031115357030074310291153566368750102311535555123961016115355673627010171153570300828103011535705449381033cREVGeometrycacheorder total14 calendarWidgeti## FILE INFORMATION # File Name .....: Calendar Widget # Version .......: 1.0.0 # Build Date ....: 2006-07-22 ## AUTHOUR INFORMATION # Written By ....: Shao Sean # Email .........: support@shaosean.tk # Website .......: www.shaosean.tk ## NOTE TO DEVELOPERS # Any of the handlers/functions that start with a "z" are considered to be private # and are called from within the public handlers. ## PUBLIC DOMAIN DISCLAIMER # This software was developed by Shao Sean and is available for use by the public # without need of a license. ## DISCLAIMER # THE SOFTWARE AND RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT WARRANTY OR INDEMNITY OF ANY KIND # INCLUDING ANY WARRANTIES OF USE, PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR # PURPOSE OR FOR ANY PURPOSE WHATSOEVER. # # USER BEARS ALL RISK RELATING TO USE, QUALITY AND PERFORMANCE OF THE SOFTWARE. constant kFieldName = "calendarWidgetField" -- change this to match the name of the field local sOldClickChunk ------------------------------------------------------------------------------------------------- -- Commands to control the calendar display -- -- calendarWidgetDraw .......... draws the calendar based on the year, month and date stored -- calendarWidgetNextMonth ..... redraws the calendar moving to the next month (wraps around on month 12) -- calendarWidgetPreviousMonth . redraws the calendar moving to the previous mont (wraps around on month 1) -- calendarWidgetNextYear ...... redraws the calendar moving to the next year (see centuryCutoff for limitations) -- calendarWidgetPreviousYear .. redraws the calendar moving to the previous year (see centuryCuttoff for limitations) ------------------------------------------------------------------------------------------------- on calendarWidgetDraw local tWidgetText lock screen zCalendarWidgetSetDateItems --- build the calendar header repeat for each line tWeekdayName in the system weekdayNames put char 1 of tWeekdayName & TAB after tWidgetText end repeat if (the last char of tWidgetText = TAB) then delete char -1 of tWidgetText put LF after tWidgetText --- build the calendar repeat (the uMonthStart of me - 1) put TAB after tWidgetText end repeat repeat with i = 1 to zCalendarWidgetNumberOfDays() put i & TAB after tWidgetText end repeat if (the last char of tWidgetText = TAB) then delete char -1 of tWidgetText put tWidgetText into field kFieldName --- populate the calendar widget zCalendarWidgetSelect the uDate of me --- hilite the day selected try calendarWidgetUpdated the uYear of me, the uMonth of me, the uDate of me, the uDay of me -- callback catch tError end try end calendarWidgetDraw on calendarWidgetNextMonth local tYear local tMonth put the uYear of me into tYear put the uMonth of me into tMonth if (tMonth = 12) then add 1 to tYear put 1 into tMonth else add 1 to tMonth set the uYear of me to tYear set the uMonth of me to tMonth calendarWidgetDraw end calendarWidgetNextMonth on calendarWidgetPreviousMonth local tYear local tMonth put the uYear of me into tYear put the uMonth of me into tMonth if (tMonth = 1) then subtract 1 from tYear put 12 into tMonth else subtract 1 from tMonth set the uYear of me to tYear set the uMonth of me to tMonth calendarWidgetDraw end calendarWidgetPreviousMonth on calendarWidgetNextYear local tYear put the uYear of me into tYear add 1 to tYear set the uYear of me to tYear calendarWidgetDraw end calendarWidgetNextYear on calendarWidgetPreviousYear local tYear put the uYear of me into tYear subtract 1 from tYear set the uYear of me to tYear calendarWidgetDraw end calendarWidgetPreviousYear ------------------------------------------------------------------------------------------------- -- Handle user input (mouse and keyboard) ------------------------------------------------------------------------------------------------- on mouseUp lock screen if (word 2 of the clickLine = 1) OR (the clickChunk is EMPTY) then if (sOldClickChunk is not EMPTY) then set the backgroundColor of sOldClickChunk to (the effective hiliteColor) end if else zCalendarWidgetSelect the clickText end mouseUp on arrowKey pKey local tToken switch case (pKey = "up") AND (the uDate of me > 7) put (the uDate of me - 7) into tToken break case (pKey = "down") AND (the uDate of me < zCalendarWidgetNumberOfDays() - 6) put (the uDate of me + 7) into tToken break case (pKey = "left") AND (the uDate of me > 1) put (the uDate of me - 1) into tToken break case (pKey = "right") AND (the uDate of me < zCalendarWidgetNumberOfDays()) put (the uDate of me + 1) into tToken break end switch if (tToken is not EMPTY) then zCalendarWidgetSetDateItems zCalendarWidgetSelect tToken end if end arrowKey ------------------------------------------------------------------------------------------------- -- Private commands.. *shoo* Go away ;-) ------------------------------------------------------------------------------------------------- on zCalendarWidgetSelect pToken if (sOldClickChunk is not EMPTY) then set the backgroundColor of sOldClickChunk to EMPTY end if select EMPTY set the itemDelimiter to TAB select item (the uMonthStart of me + pToken + 5) of fld kFieldName set the uDate of me to (the selectedText) set the uDay of me to (the uMonthStart of me + pToken + 5) mod 7 +1 set the backgroundColor of the selectedChunk to (the effective hiliteColor) put the selectedChunk into sOldClickChunk try calendarWidgetDateChanged the uYear of me, the uMonth of me, the uDate of me, the uDay of me catch tError end try end zCalendarWidgetSelect function zCalendarWidgetNumberOfDays if (the uMonth of me is among the items "1,3,5,7,8,10,12") then return 31 else if (the uMonth of me is among the items "4,6,9,11") then return 30 else if ((the uYear of me MOD 400 = 0) OR ((the uYear of me MOD 100 <> 0) AND (the uYear of me MOD 4 = 0))) then return 29 else return 28 end zCalendarWidgetNumberOfDays on zCalendarWidgetSetDateItems --- get today's dateItems if (the uYear of me is EMPTY) OR (the uMonth of me is EMPTY) OR (the uDate of me is EMPTY) then convert the seconds to dateItems set the uYear of me to item 1 of it set the uMonth of me to item 2 of it set the uDate of me to item 3 of it set the uDay of me to item 7 of it else convert (the uYear of me,the uMonth of me,the uDate of me,3,59,59,0) from dateItems to seconds convert it from seconds to dateItems set the uDay of me to item 7 of it end if --- get the month's start day convert (the uYear of me,the uMonth of me,1,3,59,59,0) from dateItems to seconds convert it from seconds to dateItems set the uMonthStart of me to item 7 of it end zCalendarWidgetSetDateItems --> MOVED FROM CARD BY CHIPP on calendarWidgetDateChanged pYear, pMonth, pDate, pDay put pYear, pMonth, pDate, pDay & LF before fld "log" end calendarWidgetDateChanged on calendarWidgetUpdated pYear, pMonth, pDate, pDay lock screen put pYear into fld "year" put line pMonth of the system monthNames into field "month" end calendarWidgetUpdated *n uMonthStart3uDay7uDate12uMonth8uYear2006 cREVGeneral revUniqueID 1153560000051 RectangleK@.~e cREVGeneral revUniqueID 1153556736270Button@ g@.~ cREVGeneral revUniqueID 1153555512396  calendarWidgetField("@.~f cREVTablecurrentvscroll0currenthscroll0currentxmouseloc72 viewablerows9currentymouseloc24scrollbarwidth20 cellyspacing13rightfieldloc264viewablecolumns9numbertabstops1 topfieldloc63 leftfieldloc114 cellxspacing18 currentview3

S M T W T F S

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

4

bottomfieldloc179 cREVGeneral revUniqueID 1153549409546  S M T W T F S V 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31    33^^ 9 Go To TodayEx on mouseUp set the uYear of group "calendarWidget" to "" set the uMonth of group "calendarWidget" to "" set the uDate of group "calendarWidget" to "" send "calendarWidgetDraw" to group "calendarWidget" end mouseUp x cREVGeneral revUniqueID 1153566368750 previousMontheWon mouseUp send "calendarWidgetPreviousMonth" to group "calendarWidget" end mouseUp Previous Month< cREVGeneral revUniqueID 1153570189912  nextMontheSon mouseUp send "calendarWidgetNextMonth" to group "calendarWidget" end mouseUp  Next Month> cREVGeneral revUniqueID 1153570234891 month "d cREVTable currentview cREVGeneral revUniqueID 1153570278846 August year "d cREVTable currentview cREVGeneral revUniqueID 1153570300743 2006 previousYeareVon mouseUp send "calendarWidgetPreviousYear" to group "calendarWidget" end mouseUp Previous Year< cREVGeneral revUniqueID 1153570300828  nextYeareRon mouseUp send "calendarWidgetNextYear" to group "calendarWidget" end mouseUp  Next Year> cREVGeneral revUniqueID 1153570300858  log!`xd cREVGeneral revUniqueID 1153570544938   `@-bCancelEx Uon mouseUp set the dialogdata to "" stripAndShip close this stack end mouseUp : cREVGeneral revUniqueID 1154781100540 OKEx fon mouseUp set the dialogdata to line 1 of fld "log" stripAndShip close this stack end mouseUp Q: cREVGeneral revUniqueID 1154781135336