# GraffitiCalendar
Class Inherits GraffitiWebUIControl
## About
GraffitiCalendar is an advanced calendar-view class. It allows for the addition of events to a calendar by using Xojo date objects, with support for a wide variety of views and allows for event dragging and resizing. Includes support for a large number of languages built-in, jQuery UI theme support, and Google Calendar imports.
Features:
*
Supports many different languages/locales
*
9 view types
*
First day of week setting
*
Custom theming with jQuery UI
*
Google Calendar import
## Preview



Previous
Next
## Warnings
### Linux Support
Support varies by Linux distribution and installed libwebkit library and version.
### Windows Support
Requires the presence of an HTMLViewer on a window or container within the project.
## Compatibility
### Framework API Version
| 1.0 | 2.0 |
| :---: | :---: |
| True | True |
### Desktop
| 32-Bit | 64-Bit |
| :---: | :---: |
| True | True |
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| Views | Month <br> MonthList <br> WeekAgenda <br> WeekBasic <br> WeekList <br> DayAgenda <br> DayBasic <br> DayList <br> YearList | All supported view types. |
| WeekNumberLocations | SeparateColumn <br> InFirstDay | Possible display positions of the week number. |
| WeekNumberTypes | Local <br> ISO | Possible types of week number. |
## Event Definitions
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Closing | (None) | (None) | |
| DayClick | day as DateTime <br> theView as GraffitiCalendar.Views | (None) | Fired when the user clicks on a day in the calendar. |
| Deselected | (None) | (None) | Fired when selected date is deselected. |
| EventChanged | target as GraffitiCalendarEvent | (None) | Fired when the user moves or resizes an event. |
| EventClick | target as GraffitiCalendarEvent | (None) | Fired when the user clicks on an existing event. |
| EventDoubleClick | target as GraffitiCalendarEvent | (None) | Fired when the user double clicks an existing event. |
| EventDropped | newEvent as GraffitiCalendarEvent | (None) | Raised upon completion of a BeginExternalDrag process. newEvent will contain the updated information about the DateTime in which the GraffitiCalendarEvent was placed. |
| EventMouseOut | target as GraffitiCalendarEvent | (None) | Fired when the user's mouse exits an existing event. |
| EventMouseOver | target as GraffitiCalendarEvent | (None) | Fired when the user's mouse enters an existing event. |
| LanguagesLoaded | (None) | (None) | Fired when the control has loaded all available languages. |
| Selected | startDate as DateTime <br> endDate as DateTime | (None) | Fired when a date or time range is selected. |
| UIReady | (None) | (None) | |
| ViewChanged | (None) | (None) | Fired when the user switched the view using the toolbar. |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Sub | AddEvent | (None) | Adds a new event to the calendar. |
| Sub | AddExternalSource | (None) | Adds a Google Calendar to the display. |
| Sub | AddViewButton | (None) | Adds a view button to the toolbar. |
| Sub | BeginExternalDrag | (None) | Begins the process to drag an object from outside the calendar to create an event within the calendar. |
| Sub | Constructor | (None) | Creates a new instance of the class. |
| Sub | DeselectAll | (None) | Deselects all currently selected dates. |
| Sub | DisableDay | (None) | Disables the specified day. |
| Sub | EnableDay | (None) | Enables the specified day. |
| Function | EventAt | As | Returns the event at the specified index in the calendar's internal array. |
| Sub | HideDaysOfWeek | (None) | Hides the specified days of the week. Values are 0-6 starting with Sunday. |
| Sub | HideDaysOfWeek | (None) | Hides the specified days of the week. Values are 0-6 starting with Sunday. |
| Function | ICSExport | As | Returns all events in ICS format. |
| Sub | ICSImport | (None) | Imports events in an ICS-formatted string. |
| Function | LastIndex | As | Returns the index of the last item in the control's internal array. |
| Function | LastViewButtonIndex | As | Returns the last view button currently added to the toolbar. |
| Sub | LoadTheme | (None) | Applies a jQuery UI theme to the calendar. |
| Sub | MoveNext | (None) | Navigates to the next day/week/month in the display. |
| Sub | MoveNextYear | (None) | Navigates to the next year. |
| Sub | MovePrev | (None) | Navigates to the previous day/week/month in the display. |
| Sub | MovePrevYear | (None) | Navigates to the previous year. |
| Sub | MoveToDate | (None) | Navigates to the defined date. |
| Sub | MoveToToday | (None) | Resets the display to display the current date. |
| Sub | RefetchEvents | (None) | Re-imports external event sources. |
| Sub | RemoveAllEvents | (None) | Removes all events from the calendar. |
| Sub | RemoveAllViewButtons | (None) | Removes all view buttons from the toolbar. |
| Sub | RemoveEvent | (None) | Removes the specified event from the calendar. |
| Sub | RemoveEventAt | (None) | Removes the event at the specified index in the control's internal array. |
| Sub | RemoveExternalSource | (None) | Removes an external source. |
| Sub | RemoveViewButton | (None) | Removes the specified view button from the toolbar. |
| Sub | RerenderEvents | (None) | Forces the display to update. |
| Sub | ScrollTo | (None) | Scrolls the supplied event in to the calendar's view. |
| Sub | ScrollTo | (None) | Scrolls the supplied event in to the calendar's view. |
| Sub | SelectDates | (None) | Selects the specified date range. |
| Sub | UpdateEvent | (None) | Updates an event in the calendar after changing properties of the Event object. |
| Function | ViewButton | As | Returns the view button at the specified index. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| BackgroundColor | Color | Nil | The background color of the display. |
| CustomTheme | Boolean | Nil | If True, uses the theme loaded by LoadTheme. |
| Enabled | Boolean | Nil | |
| FirstDayOfWeek | Integer | Nil | First day of the week, -1 is the current locale default, 0-6 are Sunday through Saturday. |
| Language | String | Nil | The current view language. |
| Languages() | String | Nil | Array of supported languages. This should be, more or less, static. |
| LockUpdate | Boolean | Nil | |
| Private | | DateTime | |
| Private | | GraffitiCalendarEvent | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | | Views | |
| Private | As | = | |
| Private | | Integer | |
| Private | | String | |
| Private | As | Nil | |
| Private | | GraffitiCalendarEvent | |
| Private | As | = | |
| RestrictEventDisplay | Boolean | Nil | Will use restrictions to hide events when True. |
| Restriction | GraffitiCalendarRestriction | Nil | Restriction to apply to display. |
| RestrictSelection | Boolean | Nil | Will restrict selection when True. |
| RestrictView | Boolean | Nil | Will restrict view when True. |
| ShowAllDaySlot | Boolean | Nil | Controls visibility of the row containing events that span entire days in applicable views. |
| ShowEventTooltips | Boolean | Nil | When True, tooltips will be automatically displayed for events on hover within the calendar. Tooltip content is the event's Description. |
| ShowNavButtons | Boolean | Nil | Shows the previous/next buttons for navigation. |
| ShowNavButtonsAtToday | Boolean | Nil | When True, navigation buttons will appear on the right to either side of the "Today" button. |
| ShowTitle | Boolean | Nil | Shows the title area which contains the current view's date range. |
| ShowTodayButton | Boolean | Nil | Shows a button allowing the user to quickly shift the view back to the current day. |
| ShowWeekNumbers | Boolean | Nil | Determines whether week numbers will be displayed. |
| ShowYearButtons | Boolean | Nil | When True, will display year navigation buttons. |
| TextSize | Integer | Nil | The default base-line text size for the display. |
| TimeFormat | String | Nil | String applied to format time values. |
| TimeMaximum | DateTime | Nil | Maximum time value. |
| TimeMinimum | DateTime | Nil | Minimum time value. |
| View | Views | Nil | The current display style. |
| ViewEnd | DateTime | Nil | Current last slot visible. |
| ViewStart | DateTime | Nil | Current first slot visible. |
| WeekNumberLocation | WeekNumberLocations | Nil | Determines where week numbers are displayed. |
| WeekNumberType | WeekNumberTypes | Nil | Determines what week number type to display. If you wish Week 1 to always be numbered "1" then use WeekNumberTypes.ISO |