GraffitiCalendar

Enumerations #

NameValues
NavigationButtonsToday
PreviousPeriod
NextPeriod
PreviousYear
NextYear
ViewsMonth
Agenda
AgendaWeek
AgendaDay
Basic
BasicWeek
BasicDay
List
ListYear
ListMonth
ListWeek
ListDay

Events #

DefinitionParametersReturn TypeDescription
DateDoubleClicktheDate as DateNoneRaised when the user double clicks a date/time.
DateSelectedDateStart as DateNoneRaised when the user clicks on a day/time on the calendar.
DateEnd as Date = nil
StartTime as Boolean = False
EndTime as Boolean = False
EventChangedtheEvent as GraffitiCalendarEventNoneFires when the user changes an event (such as by dragging).
EventDoubleClicktheEvent as GraffitiCalendarEventNoneRaised when the user double-clicks an event.
atDate as Date
EventFromRowSetnewEvent as GraffitiCalendarEventNoneRaised when a new event is created from a RowSet.
EventMouseEntertheEvent as GraffitiCalendarEventNoneRaised when the user moves their mouse in to an event.
X as Integer
Y as Integer
EventMouseLeavetheEvent as GraffitiCalendarEventNoneRaised when the user moves their mouse out of an event.
EventSelectedtheEvent as GraffitiCalendarEventNoneRaised when the user clicks an event.
atDate as Date
EventToRowSettheEvent as GraffitiCalendarEventNoneRaised when an event is modified.
LanguagesLoadedCalLanguages() as StringNoneThis event is raised once the calendar has completely loaded the list of available languages, and facilitates dynamic locale selection.
NavigationButtonPressedbutton as GraffitiCalendar.NavigationButtonsNoneRaised when the user clicks one of the navigation buttons in the toolbar. Does not cancel the default action.
ViewChangedNewView as IntegerNoneFired when the user changes the view (IE: from Month to Week to Day).
StartDate as Date
EndDate as Date

Methods #

DefinitionDescription
AddEvent( newEvent as GraffitiCalendarEvent )Add a new event to the calendar.
AddExternalSource( URL as String, BGColor as Color = &c3a87ad, BorderColor as Color = &c3a87ad, TextColor as Color = &cFFFFFF )Add an external source to the calendar, such as a Google Calendar feed.
AddRowSet( rs as RowSet )Adds a RowSet’s entries to the calendar. See nots for schema.
AddRestriction( theRestriction as GraffitiCalendarRestriction )Adds a view restriction.
AddRowSet( rs as RowSet )Adds a RowSet’s entries to the calendar. See nots for schema.
AddViewButton(View as Views)Adds a new view button to the right-hand side of the header.
DayTitle(Day as Date) as StringReturns the title set for the specified date.
DayTitle(Day as Date, Title as String, Style as WebStyle = Nil)Sets the day title with optional style for a date.
DeselectAll()Deselect all selected dates and events.
EventsAtDate( theDate as Date) As GraffitiCalendarEvent()Returns an array of GraffitiCalendarEvents that fall on the specified date, including recurring events.
FindEvent( theID as Integer ) As GraffitiCalendarEventUsed to find an event by ID, and return the event object.
FindEventIndex( theID as Integer ) as IntegerUsed to find an event by ID, and return an integer index.
ICSExport( Domain as String ) as StringExports all current events to ICS format.
ICSImport( theICS as String )Imports ICS-formatted event data to GraffitiCalendar events.
MoveNext()Move to the next Month/Week/Day
MoveNextYear()Move to the next year.
MovePrev()Move to the previous Month/Week/Day
MovePrevYear()Move to the previous year.
MoveToDate( theDate as Date )Bring theDate in to view.
MoveToToday()Move the view to show the current date.
Print()Opens a print dialog with print-save version of the current view.
RefetchEvents()Causes the calendar to refetch all events. Useful if changes are made to an external source.
RemoveAllEvents()Removes all events from the calendar.
RemoveAllRestrictions()Removes all restrictions from the calendar view.
RemoveAllViewButtons()Removes all view buttons.
RemoveEvent( theEvent as GraffitiCalendarEvent )Remove the supplied event object from the calendar.
RemoveExternalSource( URL as String )Remove the external source signified by URL.
RemoveRestriction( theID as String )Removes a restriction from the calendar view.
RemoveViewButton(index as Integer)Removes the specified view button.
RerenderEvents()Forces the calendar to rerender all events. Useful if you notice any weirdness.
SelectDates( StartDate as Date, EndDate as Date )Selects a range of dates in the view.
UpdateEvent( theEvent as GraffitiCalendarEvent )Updates theEvent. The GraffitiCalendarEvent object passed should be the same one that has been modified.
ViewButton(index as Integer) as ViewsReturns the view button at the specified index.
ViewButtonCount() as IntegerReturns the number of View buttons.

Properties #

NameTypeDefault ValueDescription
CalendarViewInteger0The current view state.
DatabaseAutoUpdateBooleanTrueWhen True and an Event has been loaded using AddRowSet, GraffitiCalendar will attempt to update the database row for that Event.
DisplayEventTimeBooleanTrueControls the visibility of time in the event display.
EditableBooleanTrueDetermines if events are editable in the display by, for example, dragging.
Events()GraffitiCalendarEventItemNilThe array of events that the calendar currently contains.
LanguageString“en”The short language string which determines the locale of the calendar. Currently contains: “en”, “ar-ma”, “ar-sa”, “ar”, “bg”, “ca”, “cs”, “da”, “de-at”, “de”, “el”, “en-au”, “en-gb”, “es”, “fa”, “fi”, “fr-ca”, “fr”, “hi”, “hr”, “hu”, “id”, “is”, “it”, “ja”, “ko”, “lt”, “lv”, “nl”, “pl”, “pt-br”, “pt”, “ro”, “ru”, “sk”, “sl”, “sr-cyrl”, “sr”, “sv”, “th”, “tr”, “uk”, “vi”, “zh-cn”, “zh-tw”
RestrictViewBooleanFalseRestricts the view to the restrictions provided via AddRestriction.
ShowDayButtonBooleanTrueDetermines if the “Day” view selector is visible.
ShowDayNamesBooleanTrueDetermines whether the bar containing the names of the days of the week is visible.
ShowMonthButtonBooleanTrueDetermines if the “Month” view selector is visible.
ShowNavButtonsBooleanTrueDetermines if the Prev/Next navigation buttons are visible.
ShowNavButtonsAtTodayBooleanTrueWhen True, shows the navigation buttons on either side of the Today button.
ShowTitleBooleanTrueWhether the calendar shows the title (IE: October 2014).
ShowTodayButtonBooleanTrueDetermines if the Today button is displayed.
ShowWeekButtonBooleanTrueDetermines if the Week button is displayed.
ShowYearButtonsBooleanTrueDetermines if the Year navigation buttons are displayed.
StyleDayFutureGraffitiStyleNilGraffitiStyle for a day following Today.
StyleDayPastGraffitiStyleNilGraffitiStyle for a day the precedes today.
StyleTodayGraffitiStyleNilGraffitiStyle for the current day.
StyleFridayHeaderGraffitiStyleNilGraffitiStyle for the Friday header.
StyleMondayHeaderGraffitiStyleNilGraffitiStyle for the MondayHeader.
StyleSaturdayHeaderGraffitiStyleNilGraffitiStyle for the SaturdayHeader.
StyleSundayHeaderGraffitiStyleNilGraffitiStyle for the SundayHeader.
StyleThursdayHeaderGraffitiStyleNilGraffitiStyle for the ThursdayHeader.
StyleTitleGraffitiStyleNilGraffitiStyle applied to the title of the view, for example July 2022 in a month view.
StyleToolbarGraffitiStyleNilGraffitiStyle for the toolbar area.
StyleToolbarButtonsGraffitiStyleNilGraffitiStyle for the toolbar buttons.
StyleTuesdayHeaderGraffitiStyleNilGraffitiStyle for the TuesdayHeader.
StyleWednesdayHeaderGraffitiStyleNilGraffitiStyle for the WednesdayHeader.
TimeMinimumDateNilRestricts new event creation to time between TimeMinimum and TimeMaximum. Both must be set for effect.
TimeMaximumDateNilRestricts new event creation to time between TimeMinimum and TimeMaximum. Both must be set for effect.
TitleFormatString“”When empty, the locale-specific default string will be displayed. Accepts moment.js formats or arbitrary text inside brackets: [Hello World].
ViewDateDateNilThe starting day of the view, if set internally. Otherwise, any date may be provided to update the view.

Examples #

Google Calendar Events #

Using the AddExternalSource method, it is possible to import the events from a public Google Calendar as a single series:

myCalendar.AddExternalSource( "en.usa#holiday@group.v.calendar.google.com", "yourAPIkey" )

GraffitiCalendar does not currently support updating Google Calendar events when changed in GraffitiCalendar. In order to support this functionality, users may implement the Google Calendar RESTful API.

Notes #

Custom Styling #

To apply custom styles to your GraffitiCalendar instance, there are a number of Style* properties provided.

AddRowSet Support #

AddRowSet is supported on all Xojo Database types.

Database Writing Support #

Automatic writing of changes to the database of GraffitiCalendarEvents added via AddRowSet is currently limited to SQLiteDatabase and OracleDatabase. Using a different database type will require writing updates to the database using the events provided.

Table Schema for AddRowSet #

+-----------------+-------------+------+-------------------------+
|      Field      | Primary Key | NULL |          Type           |
+-----------------+-------------+------+-------------------------+
| id              | Yes         | No   | Integer (auto-increment)|
| title           | No          | No   | String                  |
| description     | No          | Yes  | String                  |
| start           | No          | No   | DateTime Equiv          |
| end             | No          | No   | DateTime Equiv          |
| all_day         | No          | Yes  | Boolean                 |
| background_color| No          | Yes  | String (#rrggbbaa)      |
| text_color      | No          | Yes  | String (#rrggbbaa)      |
| border_color    | No          | Yes  | String (#rrggbbaa)      |
| can_move        | No          | Yes  | Boolean                 |
| can_resize      | No          | Yes  | Boolean                 |
| location        | No          | Yes  | String                  |
| repeat_frequency| No          | No   | Integer (default '-1')  |
| repeat_period   | No          | No   | Integer (default '-1')  |
| tooltip         | No          | Yes  | String                  |
| url             | No          | Yes  | String                  |
+-----------------+-------------+------+-------------------------+