PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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 processes associated with the Timeline control
  • Advanced use of processes with procedure
  • Properties specific to the TimeLine controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
A TimeLine control can be:
To handle a TimeLine control by programming, WINDEV proposes the TimeLine functions.
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.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Handling the TimeLine control by programming

Adding a track

Adding a track into a TimeLine control is performed by TimelineAddTrack.
Example:
// Adds tracks into a TimeLine control
TimelineAddTrack(TL_Timeline1, "Sub Bass")
TimelineAddTrack(TL_Timeline1, "Scratchy Drums")
TimelineAddTrack(TL_Timeline1, "Guitar1")
Note: TimelineAddTrack is used to insert a background image into the track.

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 that handles an EventTimeline variable.
    TimelineDeleteAll(TL_Robots)
    Evt is EventTimeline

    TimelineAddTrack(TL_Robots, "Robot 1")
    Evt..Track = "Robot 1"
    Evt..Title = "Startup"
    Evt..Start = 10
    Evt..End = 150
    Evt..BrushColor = LightGreen
    TimelineAddEvent(TL_Robots, Evt)

    Evt..Track = "Robot 1"
    Evt..Title = "Special process"
    Evt..Start = 150
    Evt..End = 450
    Evt..BrushColor = PastelBlue
    TimelineAddEvent(TL_Robots, Evt)
The ..BrushColor property of the EventTimeline variable is used 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

TimelineListEvent is used to retrieve:
  • 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

TimelineDeleteEvent is used to delete:
  • 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.

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 processes of the TimeLine control.
In the relevant process, all you have to do is 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 popup menu, all you have to do is enter in the "Enter an event in input" process:
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 processes of the TimeLine control. Indeed, a procedure was automatically declared by the TimeLine control for each control process that handles an event, .
These procedures receive in parameter an EventTimeline variable affected by the process.
Advanced use of the processes associated with the Timeline control

Advanced use of processes 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 "Enter the event in input" process. To lock the direct input, the process must return False.
This principle can be applied to all the processes 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.
Versions 18 and later
EndTotalRange
New in version 18
EndTotalRange
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.
Versions 18 and later
EndVisibleRange
New in version 18
EndVisibleRange
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.
Versions 16 and later
GranularityDuration
New in version 16
GranularityDuration
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.
Versions 16 and later
GranularityMovement
New in version 16
GranularityMovement
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.
Versions 18 and later
RulerModifiable
New in version 18
RulerModifiable
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.
Versions 18 and later
RulerValue
New in version 18
RulerValue
RulerValue
..RulerValue is used to find out and modify the position of a ruler in a TimeLine control.
Versions 18 and later
RulerVisible
New in version 18
RulerVisible
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.
Versions 18 and later
StartTotalRange
New in version 18
StartTotalRange
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.
Versions 18 and later
StartVisibleRange
New in version 18
StartVisibleRange
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.
To find out the entire list of WLanguage properties that can be used with a TimeLine control, see Properties associated with the TimeLine control.
Minimum required version
  • Version 18
Comments
Click [Add] to post a comment