PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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
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 <TimeLine>.AddTrack.
Example:
// Adds tracks into a TimeLine control
TL_TimeLine1.AddTrack("Sub Bass")
TL_TimeLine1.AddTrack("Scratchy Drums")
TL_TimeLine1.AddTrack("Guitar 1")
Note: <TimeLine>.AddTrack is used to insert a background image into the track.

Adding an event

Adding an event into a TimeLine control is performed by <TimeLine>.AddEvent. 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

    TL_Music.AddEvent(MyTrack, MyTitle, EvtStart, EvtEnd)
  • syntax that is using an EventTimeline variable.
    TL_Robots.DeleteAll()
    Evt is EventTimeline

    TL_Robots.AddTrack("Robot 1")
    Evt..Track = "Robot 1"
    Evt..Title = "Start"
    Evt..Start = 10
    Evt..End = 150
    Evt..BrushColor = LightGreen
    TL_Robots.AddEvent(Evt)

    Evt..Track = "Robot 1"
    Evt..Title = "Special process"
    Evt..Start = 150
    Evt..End = 450
    Evt..BrushColor = PastelBlue
    TL_Robots.AddEvent(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 <TimeLine>.AddEvent.
TL_Robots.DeleteAll()
// Declare the events
Evt is EventTimeline

// Browse the Robot data file
FOR EACH Robot
TL_Robots.AddTrack(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
TL_Robots.AddEvent(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

<TimeLine>.ListEvent 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 = TL_Timeline.ListEvent()
  • 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 = TL_Robots.ListEvent("Robot 1", 50, 100)
  • the event currently selected or hovered:
    // Selected event
    arrEvtList is array of EventTimeline

    arrEvtList = TL_Robots.ListEvent(schAptSelected)

Deleting an event

<TimeLine>.DeleteEvent is used to delete:
  • the event selected in the control.
  • a specific event.
// Deletes the first event
TL_MyTimeLine.DeleteEvent(1)

Deleting a track

<TimeLine>.DeleteTrack is used to delete a track from the TimeLine control.
// Deletes the SOUND track
ResDel is boolean
ResDel = TL_MYTIMELINE.DeleteTrack("Sound")
IF ResDel = True THEN
Info("Track successfully deleted")
END
<TimeLine>.DeleteAll 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 <TimeLine>.ChangeMode. 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.
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 version required
  • Version 23
Comments
Click [Add] to post a comment