--- title: "Perspective - Equipment Schedule Scripting" --- # Perspective - Equipment Schedule Scripting > The [Perspective Event Types Reference](appendix/reference-pages/perspective-event-types-reference.md) page describes all the possible component event types for Perspective components. Not all component events support each Perspective component. The [Component Events and Actions](ignition-modules/perspective/working-with-perspective-components/component-events-and-actions.md) page shows how to configure events and actions on a Perspective component. Component scripting is handled separately and can be accessed from the Component menubar or by right clicking on the component. ## Component Events ## onAddEvent Event is fired after a user adds an event to the schedule. :::note This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the **event** object, which is passed to the script action as a parameter. ::: ### event.end * Object Path * event.end * Type * Integer or float * Description * The end date of the new event. ### event.itemId * Object Path * event.itemId * Type * String, integer, or float * Description * The item identifier where this event was created. ### event.start * Object Path * event.start * Type * Integer or float * Description * The start date of the new event. ```python title="Example" from random import random, randint format = "yyyy-MM-dd HH:mm:ss z" locale = "en-us" scheduled = self.props.scheduledEvents r = random() * 255 g = random() * 255 b = random() * 255 color = "rgb(" + str(r) + "," + str(g) + "," + str(b) + ")" percentDone = randint(0, 100) leadTime = randint(300, 6000) item = { "endDate": system.date.parse(event.end, format, locale), "itemId": event.itemId, "startDate": system.date.parse(event.start, format, locale), "eventId": "event_" + str(randint(1000, 10000)), "backgroundColor": color, "percentDone": percentDone, "leadTime": leadTime } scheduled.append(item) ``` ## onMoveEvent Event is fired after a user moves an event. :::note This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the **event** object, which is passed to the script action as a parameter. ::: ### event.end * Object Path * event.end * Type * Integer or float * Description * The new end date of the moved event. ### event.eventId * Object Path * event.eventId * Type * String, integer, or float * Description * The event identifier of the moved event. ### event.itemId * Object Path * event.itemId * Type * String, integer, or float * Description * The item identifier where this event was moved. ### event.start * Object Path * event.start * Type * Integer or float * Description * The new start date of the moved event. ```python title="Example" format = "yyyy-MM-dd HH:mm:ss z" locale = "en-us" scheduled = self.props.scheduledEvents for count, toFind in enumerate(scheduled): if toFind.eventId == event.eventId and event.itemId == toFind.itemId: toFind.startDate = system.date.parse(event.start, format, locale) toFind.endDate = system.date.parse(event.end, format, locale) ``` ## onResizeEvent Event is fired after a user resizes an event. :::note This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the **event** object, which is passed to the script action as a parameter. ::: ### event.end * Object Path * event.end * Type * Integer or float * Description * The new end date of the resized event. ### event.eventId * Object Path * event.eventId * Type * String, integer, or float * Description * The event identifier of the resized event. ### event.itemId * Object Path * event.itemId * Type * String, integer, or float * Description * The item identifier where this event was resized. ### event.start * Object Path * event.start * Type * Integer or float * Description * The new start date of the resized event. ```python title="Example" format = "yyyy-MM-dd HH:mm:ss z" locale = "en-us" scheduled = self.props.scheduledEvents for count, toFind in enumerate(scheduled): if toFind.eventId == event.eventId and event.itemId == toFind.itemId: toFind.startDate = system.date.parse(event.start, format, locale) toFind.endDate = system.date.parse(event.end, format, locale) ``` ## onDeleteEvent Event is fired after a user deletes an event. :::note This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the **event** object, which is passed to the script action as a parameter. ::: ### event.end * Object Path * event.end * Type * Integer or float * Description * The end date of the deleted event. ### event.eventId * Object Path * event.eventId * Type * String, integer, or float * Description * The event identifier of the deleted event. ### event.itemId * Object Path * event.itemId * Type * String, integer, or float * Description * The item identifier where this event was deleted. ### event.start * Object Path * event.start * Type * Integer or float * Description * The start date of the deleted event. ```python title="Example" scheduled = self.props.scheduledEvents format = "yyyy-MM-dd HH:mm:ss z" locale = "en-us" for count, toFind in enumerate(scheduled): if toFind.eventId == event.eventId and toFind.itemId == event.itemId: del scheduled[count] break ``` ## onClickEvent Event is fired after a user clicks on an event. :::note This component event is designed to be used in tandem with a script runAction. Within the script action, special properties and methods are available on the **event** object, which is passed to the script action as a parameter. ::: ### event.end * Object Path * event.end * Type * Integer or float * Description * The end date of the clicked event. ### event.eventId * Object Path * event.eventId * Type * String, integer, or float * Description * The event identifier of the clicked event. ### event.itemId * Object Path * event.itemId * Type * String, integer, or float * Description * The item identifier where this event was clicked. ### event.start * Object Path * event.start * Type * Integer or float * Description * The start date of the clicked event. ```python title="Example" scheduled = self.props.scheduledEvents format = "yyyy-MM-dd HH:mm:ss z" locale = "en-us" for count, toFind in enumerate(scheduled): if toFind.eventId == event.eventId and toFind.itemId == event.itemId: print scheduled[count] break ``` ## Component Functions This component does not have component functions associated with it. ## Extension Functions This component does not have extension functions associated with it.