|
- Overview
- Handling the TimeLine control by programming
- Adding a track
- Adding an event
- Filling a TimeLine control with the data found in a HFSQL data file
- Retrieving a list of events
- Deleting an event
- Deleting a track
- Modifying the display of the control
- Using the popup menu (AAF)
- Advanced use of the events associated with the Timeline control
- Advanced use of events with procedure
- Properties specific to the TimeLine controls
Handling a TimeLine control by programming
A TimeLine control can be: This help page explains how to handle a TimeLine control by programming. The example proposed in illustration is used to store the events in a HFSQL database.
Remark: From version 19, HFSQL is the new name of HyperFileSQL. Handling the TimeLine control by programming Adding a track Example:
// Adds tracks in a TimeLine control TL_TimeLine1 TimelineAddTrack(TL_Timeline1, "Sub Bass") TimelineAddTrack(TL_Timeline1, "Scratchy Drums") TimelineAddTrack(TL_Timeline1, "Guitar1")
Adding an event Adding an event into a TimeLine control is performed by TimelineAddEvent. This function accepts two syntaxes: - syntax used to specify the characteristics of the event: 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 handling an 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 Property ..CouleurFond of the Variable EventTimeline allows to define a display Color for an event. If no background color is defined, the TimeLine control will automatically use the color associated with the category of the event. Filling a TimeLine control with the data found in a HFSQL data file The records are stored in a HFSQL data file. The initial fill of the TimeLine control can be done by browsing the data file via the FOR EACH syntax and by adding each event via 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..BrushColor = Evt_Robot.EvtColor TimelineAddEvent(TL_Robots, Evt) END END
Reminder: You also have the ability to use a TimeLine control linked to a data file. See TimeLine control linked to a data file for more details. Retrieving a list of events - the list of all events found 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 for a track included 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 event currently selected or hovered:
// 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 ResSup = TimelineSupprimePiste(TL_MonTimeLine, "Son") 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. Modifying the display of the control The current display of a TimeLine control can be modified by TimelineChangeMode. This function is used to modify the display mode of control: second, millisecond or microsecond. Using the popup menu (AAF) The Timeline control is associated with a popup menu (AAF). The popup menu of the TimeLine control allows you to: - perform a zoom on 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 event "Enter an event in input":
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. Indeed, a procedure has been automatically declared by the TimeLine control for each WLanguage event associated with the control that handles an event. These procedures receive in parameter an EventTimeline variable affected by the process. Advanced use of the events associated with the Timeline control Advanced use of events with procedure You can also allow the user to define more precisely the characteristics of his event during an addition or a modification. To do so, create a window with the information to specify. In the code, all you have to do is open the window in the event "Enter the event in input". To lock the direct input, the process must return False. This principle can be applied to all WLanguage events called via the popup menu of the TimeLine control. Example: Opening a window for entering the event.
PROCEDURE EnterInInput(evtEdited is EventTimeline) // Opens the window for entering an event // with the selected event (in Creation or Modification mode) Open(WIN_InputEvt_HFSQL, evtEdited) // Returns False to lock the direct input in the TimeLine control RESULT False
Properties specific to the TimeLine controls The following properties are used to manage a TimeLine control by programming.
| | EndTotalRange | ..EndTotalRange is used to: - find out and modify the last displayable date or time in a Scheduler control or in a TimeLine control.
- modify the last displayable time in a TimeLine control.
| EndVisibleRange | ..EndVisibleRange 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 | ..GranularityDuration allows you to find out and modify the size of the grid used to resize:- the appointments of an Organizer control.
- the appointments of a Scheduler control.
- the events of a TimeLine control.
- the tasks found in a Gantt Chart column.
| GranularityMovement | ..GranularityMovement is used to find out and modify the size of the grid used to move: - the appointments of an Organizer control.
- the appointments of a Scheduler control.
- the events of a TimeLine control.
- the tasks found in a Gantt Chart column.
| RulerModifiable | ..RulerModifiable is used to: - Find out whether the ruler of a TimeLine control can be moved by the user.
- Make the ruler of a TimeLine control movable (or not) by the user.
| RulerValue | ..RulerValue is used to find out and modify the position of a ruler in a TimeLine control. | RulerVisible | ..RulerVisible is used to: - Find out whether a ruler is visible in a TimeLine control.
- Make a ruler visible or invisible in a TimeLine control.
| StartTotalRange | ..StartTotalRange is used to: - find out and modify the first displayable date or time in a Scheduler control or in a TimeLine control.
- modify the first displayable time in a TimeLine control.
| StartVisibleRange | ..StartVisibleRange is used to: - find out and modify the first visible date or time in a Scheduler control or in a TimeLine control.
- modify the first visible time in a TimeLine control.
|
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |