|
|
|
|
- Overview
- Handling TimeLine controls programmatically
- Adding a track
- Adding an event
- Populating a TimeLine control with the data from an HFSQL data file
- Retrieving a list of events
- Deleting an event
- Deleting a track
- Changing the time scale of the control
- Using the context menu (AAF)
- Advanced use of the events associated with the Timeline control
- Advanced use of events with procedures
- Properties specific to TimeLine controls
Manipular un control Línea de tiempo mediante programación
A TimeLine control can be: This help page explains how to handle TimeLine controls programmatically. The example below stores the events in an HFSQL database.
Handling TimeLine controls programmatically Adding a track Example:
// Adds tracks in TL_TimeLine1 TimelineAddTrack(TL_Timeline1, "Sub Bass") TimelineAddTrack(TL_Timeline1, "Scratchy Drums") TimelineAddTrack(TL_Timeline1, "Guitar1")
Adding an event To add an event to a TimeLine control, use TimelineAddEvent. This function accepts two syntaxes: - syntax used to specify the characteristics of the event: title, description, etc, ...
// Adds a 5-second event into a TimeLine control configured to the second MyTrack is string MyTitle is string EvtStart is int EvtEnd is int MyTrack = "Strings" MyTitle = "Start" EvtStart = 4 EvtEnd = 9 TimelineAddEvent(TL_Music, MyTrack, MyTitle, EvtStart, EvtEnd)
- syntax that handles a variable of type EventTimeline.
TimelineDeleteAll(TL_Robots) Evt is EventTimeline TimelineAddTrack(TL_Robots, "Robot 1") Evt.Track = "Robot 1" Evt.Title = "Start" Evt.Start = 10 Evt.End = 150 Evt.BackgroundColor = LightGreen TimelineAddEvent(TL_Robots, Evt) Evt.Track = "Robot 1" Evt.Title = "Special process" Evt.Start = 150 Evt.End = 450 Evt.BackgroundColor = PastelBlue TimelineAddEvent(TL_Robots, Evt)
The BackgroundColor property of the EventTimeline variable is used to define the color used to display an event. If no background color is defined, the TimeLine control will automatically use the color associated with the category of the event. Populating a TimeLine control with the data from an HFSQL data file The records are stored in an HFSQL data file. To populate the TimeLine control for the first time, you can use a FOR EACH loop or add each event with TimelineAddEvent.
TimelineDeleteAll(TL_Robots) // Declare the events Evt is EventTimeline // Browse the Robot data file FOR EACH Robot TimelineAddTrack(TL_Robots, Robot.RobotName) // Browse the Evt_Robot data file FOR EACH Evt_Robot WITH RobotID = Robot.RobotID Evt.ToolTip = Evt_Robot.EvtTooltip Evt.Title = Evt_Robot.EvtTitle Evt.Start = Evt_Robot.EvtStart Evt.End = Evt_Robot.EvtEnd Evt.Content = Evt_Robot.EvtContent Evt.Track = Robot.RobotName Evt.BackgroundColor = Evt_Robot.EvtColor TimelineAddEvent(TL_Robots, Evt) END END
Reminder: You can also use a TimeLine control linked to a data file. For more details, see TimeLine control linked to a data file. Retrieving a list of events - the list of all events in the TimeLine control:
// Array containing a list of events arrEvtList is array of EventTimeline // List of events arrEvtList = TimelineListEvent(TL_Timeline)
- the list of events of a track between two specific times:
// List of events for robot 1 found between 50s and 100s arrEvtList is array of EventTimeline arrEvtList = TimelineListEvent(TL_Robots, "Robot 1", 50, 100)
- the currently selected or hovered event:
// Selected event arrEvtList is array of EventTimeline arrEvtList = TimelineListEvent(TL_Robots, schAptSelected)
Deleting an event - the event selected in the control.
- a specific event.
// Deletes the first event TimelineDeleteEvent(TL_MyTimeLine, 1)
Deleting a track TimelineDeleteTrack is used to delete a track from the TimeLine control.
// Deletes the SOUND track ResDel is boolean ResDel = TimelineDeleteTrack(TL_MyTimeLine, "Sound") IF ResDel = True THEN Info("Track successfully deleted") END
TimelineDeleteAll is used to delete all the events from the TimeLine control as well as all its tracks. Changing the time scale of the control You can change the time scale of a TimeLine control with TimelineChangeMode. This function changes the control display mode: second, millisecond or microsecond. Using the context menu (AAF) The Timeline control is associated with a context menu (AAF). The context menu of the TimeLine control allows you to: - zoom or out in the control,
- add, modify or delete an event.
To save the operations performed, you must use the WLanguage events associated with the TimeLine control. In the corresponding WLanguage event, simply retrieve the event currently used and perform the corresponding process. Example: To store in an "EVT" data file an event that the user adds via the context menu, simply enter the following code in the "Enter input mode in an event" event: PROCEDURE EnterInInput(evtEdited is EventTimeline) // Store the data EVT.Title = evtEdited.Title EVT.EvtStart = evtEdited.Start EVT.EvtEnd = evtEdited.End ... HAdd(EVT)
The same type of code can be implemented for the different events associated with the TimeLine control. A procedure is automatically declared by the TimeLine control for each WLanguage event associated with the control that handles an event. These procedures receive a variable of type EventTimeline as parameter. Advanced use of the events associated with the Timeline control Advanced use of events with procedures You can also allow users to define more precisely the characteristics of the events when they are added or modified. To do so, create a window with the information to specify. In the code, specify that the window must be opened in the "Enter input mode in an event" event. To lock the direct input, the process must return False. This principle can be applied to all WLanguage events called via the context menu of the TimeLine control. Example: Opening a window for entering the event. PROCEDURE EnterInInput(evtEdited is EventTimeline)
Open(WIN_InputEvt_HFSQL, evtEdited)
RESULT False
Properties specific to TimeLine controls The following properties are used to handle TimeLine controls.
| | EndTotalRange | El EndTotalRange Property se utiliza para: - get la última fecha u hora que se puede mostrar en un Programador o control Línea de tiempo.
- cambiar la última vez que se puede mostrar en un control Línea de tiempo.
| EndVisibleRange | El EndVisibleRange Property se utiliza para: - averigua y modifica la última fecha u hora de Visible en un control Planificador o en un control Línea de tiempo.
- modificar el último tiempo de Visible en un control Línea de tiempo.
| GranularityDuration | El GranularidadDuración Property se utiliza para get y cambiar el tamaño de la cuadrícula a redimensionar:
Citas de * en un control Agenda.
Citas de * en un control Planificador.
Eventos * en una control Línea de tiempo.
Tareas de * en una columna del diagrama de Gantt. | GranularityMovement | El GranularidadMovimiento Property se utiliza para get y cambiar el tamaño de la cuadrícula para moverse:
Citas de * en un control Agenda.
Citas de * en un control Planificador.
Eventos * en una control Línea de tiempo.
Tareas de * en una columna del diagrama de Gantt. | RulerModifiable | La propiedad RulerModifiable permite: - Averigua si el usuario puede mover el cabezal de reproducción en un control Línea de tiempo.
- Permitir o impedir que el usuario mueva el cabezal de reproducción en un control Línea de tiempo.
| RulerValue | El RulerValue Property se utiliza para get o cambiar la posición del cabezal de reproducción en un control Línea de tiempo. | RulerVisible | El RulerVisible Property se utiliza para: - Determinar si un cabezal de reproducción es Visible en un control Línea de tiempo.
- Mostrar u ocultar un cabezal de reproducción en un control Línea de tiempo.
| StartTotalRange | El StartTotalRange Property se utiliza para: - get la primera fecha u hora que se mostrará en un Planificador o control Línea de tiempo.
- cambiar la primera vez que se puede mostrar en un control Línea de tiempo.
| StartVisibleRange | El StartVisibleRange Property se utiliza para: - obtiene y cambia la primera fecha u hora de Visible en un Programador o control Línea de tiempo.
- cambiar el primer tiempo Visible en un control Línea de tiempo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|