|
|
|
|
|
- Overview
- Manipulating 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
Manipulating TimeLine controls programmatically
A TimeLine control can be: In WINDEV, you can use TimeLine functions to manipulate TimeLine controls programmatically. This help page explains how to programmatically manipulate TimeLine controls. The example below stores the events in an HFSQL database. Manipulating TimeLine controls programmatically Adding a track Example:
TimelineAddTrack(TL_TimeLine1, "Sub Bass")
TimelineAddTrack(TL_TimeLine1, "Scratchy Drums")
TimelineAddTrack(TL_TimeLine1, "Guitar 1")
Adding an event To add an event to a TimeLine control, use TimelineAddEvent. This function accepts two syntaxes: - syntax for specifying event characteristics: title, description, ...
// 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_Automates)
Evt is EventTimeline
TimelineAddTrack(TL_Automates, "Automate 1")
Evt.Track = "Automate 1"
Evt.Title = "Démarrage"
Evt.Start = 10
Evt.End = 150
Evt.BackgroundColor = LightGreen
TimelineAddEvent(TL_Automates, Evt)
Evt.Track = "Automate 1"
Evt.Title = "Traitement spécial"
Evt.Start = 150
Evt.End = 450
Evt.BackgroundColor = PastelBlue
TimelineAddEvent(TL_Automates, 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_Automates)
Evt is EventTimeline
FOR EACH Automate
TimelineAddTrack(TL_Automates, Automate.NomAutomate)
FOR EACH Evt_Automate where IDAutomate = Automate.IDAutomate
Evt.ToolTip = Evt_Automate.EvtBulle
Evt.Title = Evt_Automate.EvtTitre
Evt.Start = Evt_Automate.EvtDébut
Evt.End = Evt_Automate.EvtFin
Evt.Content = Evt_Automate.EvtContenu
Evt.Track = Automate.NomAutomate
Evt.BackgroundColor = Evt_Automate.EvtCouleur
TimelineAddEvent(TL_Automates, Evt)
END
END
Remember: It's also possible to use a TimeLine field 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:
tabListeEvt is array of EventTimeline
tabListeEvt = TimelineListEvent(TL_TimeLine)
- the list of events of a track between two specific times:
tabListeEvt is array of EventTimeline
tabListeEvt = TimelineListEvent(TL_Automates, "Automate 1", 50, 100)
- the currently selected or hovered event:
tabListeEvt is array of EventTimeline
tabListeEvt = TimelineListEvent(TL_Automates, schAptSelected)
Deleting an event - the event selected in the control.
- a specific event.
TimelineDeleteEvent(TL_MonTimeLine, 1)
Deleting a track TimelineDeleteTrack is used to delete a track from the TimeLine control.
ResSup is boolean
ResSup = TimelineDeleteTrack(TL_MonTimeLine, "Son")
IF ResSup = True THEN
Info("Piste supprimée")
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 can be used to change the field 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 added by the user via the context menu, simply enter the following code in the "Event entry" event: PROCEDURE EntréeEnSaisie(evtEdité is EventTimeline)
EVT.Titre = evtEdité.Titre
EVT.DébutEvt = evtEdité.Début
EVT.FinEvt = evtEdité.Fin
...
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 EntréeEnSaisie(evtEdité is EventTimeline)
Open(FEN_SaisieEvt_HFSQL, evtEdité)
RETURN False
Properties specific to TimeLine controls The following properties are used to manipulate TimeLine controls.
| | EndTotalRange | The EndTotalRange property is used to: - get the last date or time that can be displayed in a Scheduler or TimeLine control.
- change the last time that can be displayed in a TimeLine control.
| EndVisibleRange | The EndVisibleRange property is used to: - find out and modify the last visible date or time in a Scheduler control or in a TimeLine control.
- modify the last visible time in a TimeLine control.
| GranularityDuration | The GranularityDuration property gets and sets the size of the grid to resize:- appointments in an Organizer control.
- appointments in a Scheduler control.
- events in a TimeLine control.
- tasks in a Gantt Chart column.
| GranularityMovement | The property GranularityDisplacement property is used to identify and modify the grid size for displacement: - appointments in an Organizer control.
- appointments in a Scheduler control.
- events in a TimeLine control.
- tasks in a Gantt Chart column.
| RulerModifiable | The property ModifiableSlide property property allows you to: - Find out whether the user can move the playhead in a TimeLine control.
- Allow or prevent the user from moving the playhead in a TimeLine control.
| RulerValue | The RulerValue property is used to get or change the position of the playhead in a TimeLine control. | RulerVisible | The property RégletteVisible property allows you to: - Determine if a playhead is visible in a TimeLine control.
- Show or hide a playhead in a TimeLine control.
| StartTotalRange | The property StartTotalExtent property allows you to: - get the first date or time that will be displayed in a Scheduler or TimeLine control.
- change the first time that can be displayed in a TimeLine control.
| StartVisibleRange | The property StartVisibleExtent property allows you to: - get and change the first visible date or time in a Scheduler or TimeLine control.
- change the first visible time in a TimeLine control.
|
For a complete list of WLanguage properties that can be used with TimeLine controls, see TimeLine control properties.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|