PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Handling the Scheduler control by programming
  • Adding a resource
  • Adding an appointment
  • Filling a Scheduler control with the data found in a HFSQL data file
  • Retrieving a list of appointments
  • Displaying the schedule from a specific resource or from a specific date
  • Deleting an appointment
  • Deleting a resource
  • Modifying the display of the control
  • Handling an appointment by programming
  • Using the popup menu (AAF)
  • Advanced use of the processes associated with the Scheduler control
  • Advanced use of processes with procedure
  • Managing bank holidays
  • Properties specific to the Scheduler 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 Scheduler control can be:
To handle a Scheduler control by programming, WINDEV and WEBDEV propose the SchedulerXXX functions.
This help page explains how to handle a Scheduler control by programming. The example proposed in illustration is used to store the appointments in a HFSQL database.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 21 and later
Android The Scheduler controls are available for the Android applications.
iPhone/iPad The Scheduler controls are available for the iPhone/iPad applications.
New in version 21
Android The Scheduler controls are available for the Android applications.
iPhone/iPad The Scheduler controls are available for the iPhone/iPad applications.
Android The Scheduler controls are available for the Android applications.
iPhone/iPad The Scheduler controls are available for the iPhone/iPad applications.
Handling the Scheduler control by programming

Adding a resource

Adding a resource into a Scheduler control is performed by SchedulerAddResource. This resource can correspond to a person, a room, ...
Example:
// Adds resources into a Scheduler control
SchedulerAddResource(SCH_Schedule1, "Vince" + gLink("VP"))
SchedulerAddResource(SCH_Schedule1, "Tommy" + gLink("TM"))
SchedulerAddResource(SCH_Schedule1, "Val" + gLink("VR"))
In this example, gLink is used to propose a displayed resource ("Vince" for example) and a resource handled by programming ("VP" for example).
WINDEVAndroidiPhone/iPad Note: SchedulerAddResource is used to insert an image into the title of the resource.

Adding an appointment

Adding an appointment into a Scheduler control is performed by SchedulerAddAppointment. This function accepts two syntaxes:
  • syntax used to specify the appointment characteristics: title, description, ...
    Example:
    // Adds a 1-hour appointment for tonight
    MyResource is string
    MyTitle is string
    StartAPT is DateTime

    MyResource = "Vince"
    MyTitle = "Sales meeting"
    StartAPT = DateSys() + "17000000"

    SchedulerAddAppointment(SCH_Schedule, MyResource, MyTitle, StartAPT)
  • syntax that handles an Appointment variable.
    Example:
    // Declares an Appointment variable
    MyAppointment is Appointment

    // Fills the appointment
    MyAppointment..Title = "Sales meeting"
    MyAppointment..Content = "Meeting to discuss the weekly objectives."
    MyAppointment..StartDate = "201003220845"
    MyAppointment..EndDate = "201003221230"
    MyAppointment..Category = "Sales"
    MyAppointment..ID = 1

    // Adds the appointment into the control
    SchedulerAddAppointment(SCH_Schedule, MyAppointment)

    The ..BrushColor property of the Appointment variable is used to define a display color for an appointment. If no background color is defined, the Scheduler control will automatically use the color associated with the category of the appointment.

Filling a Scheduler control with the data found in a HFSQL data file

The records are stored in a HFSQL file. The initial fill of the Scheduler control can be done by browsing the data file via the FOR EACH syntax and by adding each appointment via SchedulerAddAppointment.
// Appointment variable
MyAppointment is Appointment

// Browse the appointments stored in database
FOR EACH APT
// Fills the information of the variable
MyAppointment..Title = APT.Title
MyAppointment..Content = APT.Content
MyAppointment..StartDate = APT.StartDate
MyAppointment..EndDate = APT.EndDate
MyAppointment..Category = APT.Category
MyAppointment..ID = APT.APTID

// Adds the appointment into the Scheduler control
SchedulerAddAppointment(SCH_MySchedule, MyAppointment)
END

Retrieving a list of appointments

SchedulerListAppointment is used to retrieve:
  • the list of all the appointments found in the Scheduler control.
    For example:
    // Array containing a list of Appointment
    arrAppointmentList is array of Appointment

    // Lists of appointments
    arrAppointmentList = SchedulerListAppointment(SCH_MySchedule)
  • the list of appointments for a resource included between two dates.
    For example:
    // List of appointments for January 2014
    arrAppointmentList is array of Appointment

    // Lists of appointments
    arrAppointmentList = SchedulerListAppointment(SCH_MyScheduler, MyResource, ...
    "20140101", "20140131")
  • the appointment currently selected or hovered.
    For example:
    // Selected appointment
    arrAppointmentList is array of Appointment

    arrAppointmentList = SchedulerListAppointment(SCH_MyScheduler, schAptSelected)
Versions 17 and later

Displaying the schedule from a specific resource or from a specific date

To display the Scheduler control from:
  • a specific resource, use SchedulerPositionResource.
    For example:
    SchedulerAddAppointment(SCH_NoName1, "ABC room", "APT 1", ...
    DateSys() + "14000", DateSys() + "16000")
    SchedulerPositionResource(SCH_NoName1, "ABC room")
  • from a specific date, use SchedulerPositionDateTime.
    For example:
    // Positions the schedule on today's date
    SchedulerPositionDateTime(SCH_Schedule, Today())
New in version 17

Displaying the schedule from a specific resource or from a specific date

To display the Scheduler control from:
  • a specific resource, use SchedulerPositionResource.
    For example:
    SchedulerAddAppointment(SCH_NoName1, "ABC room", "APT 1", ...
    DateSys() + "14000", DateSys() + "16000")
    SchedulerPositionResource(SCH_NoName1, "ABC room")
  • from a specific date, use SchedulerPositionDateTime.
    For example:
    // Positions the schedule on today's date
    SchedulerPositionDateTime(SCH_Schedule, Today())

Displaying the schedule from a specific resource or from a specific date

To display the Scheduler control from:
  • a specific resource, use SchedulerPositionResource.
    For example:
    SchedulerAddAppointment(SCH_NoName1, "ABC room", "APT 1", ...
    DateSys() + "14000", DateSys() + "16000")
    SchedulerPositionResource(SCH_NoName1, "ABC room")
  • from a specific date, use SchedulerPositionDateTime.
    For example:
    // Positions the schedule on today's date
    SchedulerPositionDateTime(SCH_Schedule, Today())

Deleting an appointment

SchedulerDeleteAppointment is used to delete:
  • the appointment selected in the control.
  • a specific appointment.
// Deletes the first appointment
SchedulerDeleteAppointment(SCH_Schedule, 1)

Deleting a resource

SchedulerDeleteResource is used to delete a resource from the Scheduler control.
// Deletes one of the resources
ResDel is boolean
ResDel = SchedulerDeleteResource(SCH_Schedule1, "Vince")
IF ResDel = True THEN
Info("Resource deleted")
END
SchedulerDeleteAll is used to delete all the appointments found in the Scheduler control as well as all the resources found in the Scheduler control.

Modifying the display of the control

The current display of a Scheduler control can be modified via the following functions:
Handling an appointment by programming
You have the ability to handle an appointment by programming:
  • by using the subscript of the appointment to modify.
  • by pointing by reference on the appointment to modify.
1. Using the subscript
A subscript is returned by SchedulerAddAppointment whenever an appointment is added into a schedule. This subscript represents the added appointment. This subscript can be used to handle the appointment directly.
Example:
APTNum is int
APTNum = 5

// Change the title displayed on the appointment #5
SCH_ROOM[APTNum]..Title = "Blue room"
2. Using a reference
To handle an appointment, use the <- operator to associate the appointment found in the Scheduler control with the Appointment variable. A modification performed on the variable will be automatically applied to the control.
Example:
A is Appointment
A <- SCH_Room[APTNum]
A..Title = "New title"
Using the popup menu (AAF)
WINDEVWindows The Scheduler control is associated with a popup menu (AAF). The popup menu of the Scheduler control is used to:
  • modify the display mode of control,
  • add, modify or delete an appointment.
To save the operations performed, you must use the processes of the Scheduler control.
In the relevant process, all you have to do is retrieve the appointment currently used and perform the corresponding process.
Example: To store in an APT data file an appointment added by the user via the popup menu, all you have to do is enter in the "Enter the appointment in input" process:
PROCEDURE Edit(aptEdited is Appointment)

// Store the data
APT.Title = aptEdited..Title
APT.StartDate = aptEdited..StartDate
APT.EndDate = aptEdited..EndDate
...
HAdd(APT)
The same type of code can be implemented for the different processes of the Scheduler control. Indeed, a procedure was automatically declared by the Scheduler control for each control process that handles an appointment.
These procedures receive in parameter an Appointment variable affected by the process.
Advanced use of the processes associated with the Scheduler control

Advanced use of processes with procedure

You can allow the user to define more precisely the characteristics of his appointment during an addition or a modification. To do so, create a window or a page with the information to fill.
In the code, all you have to do is open the window or the page in the "Enter the appointment in input" process. To lock the direct input, the process must return False.
WINDEVWindows This principle can be applied to all the processes called by the popup menu of the Scheduler control.
Example: Opening a window used to enter the appointment.
PROCEDURE Edit(aptEdited is Appointment)

// Opens the window for entering an appointment
// with the selected appointment (in Creation or Modification mode)
Open(WIN_InputAPT_HFSQL, aptEdited)

// Returns False to lock the direct input in the Scheduler control
RESULT False
Managing bank holidays
The bank holidays are managed by programming. Several WLanguage functions (starting with BankHolidayXXX) are available.
To define the bank holidays displayed in the Organizer, Scheduler and Calendar controls, you must use BankHolidayAdd. This function allows you to define the list of bank holidays that will be used. This function allows you to customize the bank holidays according to the country and to the local regulations. This function must be used at the beginning of the application because it has a global effect on the application.
The bank holidays will be colored in green in the schedule.
Example:
// Delete all bank holidays
BankHolidayDeleteAll()
// Initialize the 11 bank holidays common to the French regions and to the French territories
BankHolidayAdd("0101") // 1st of January
BankHolidayAdd(bhEasterMonday) // Easter Monday
BankHolidayAdd("0501") // 1st of May
BankHolidayAdd("0508") // 8th of May
BankHolidayAdd(bhAscensionDay) // Ascension day
BankHolidayAdd(bhWhitMonday) // Whit Monday
BankHolidayAdd("0714") // 14th of July
BankHolidayAdd("0815") // 15th of August (Assumption)
BankHolidayAdd("1101") // All Saints' Day
BankHolidayAdd("1111") // 11th of November
BankHolidayAdd("1225") // Christmas

// Add 2 additional bank holidays for the regions of Moselle and Alsace
BankHolidayAdd("1226" + CR + bhGoodFriday)
Properties specific to the Scheduler controls
The following properties are used to manage a Scheduler control by programming.
Versions 17 and later
DayBreakHeight
New in version 17
DayBreakHeight
DayBreakHeight
..DayBreakHeight is used to find out and modify the height of the breaks between the days in a Scheduler control where the days are displayed in row and the resources in column.
Versions 17 and later
DayHeight
New in version 17
DayHeight
DayHeight
..DayHeight is used to find out and modify the height of the days in a Scheduler control where the days are displayed in row and the resources in column.
Versions 17 and later
DayWidth
New in version 17
DayWidth
DayWidth
..DayWidth is used to find out and modify the width of days:
  • in a Scheduler control where the days are displayed in column and the resources in row.
  • in a Gantt Chart column.
Versions 17 and later
DirectInputAPT
New in version 17
DirectInputAPT
DirectInputAPT
..DirectInputAPT is used to find out and specify whether a user can directly modify the title of an appointment in an Organizer or Scheduler control.
Versions 14 and later
EndDate
New in version 14
EndDate
EndDate
..EndDate is used to find out and modify the end date of the period selected:
  • in a Calendar control,
  • in an Organizer control.
  • in a Scheduler control.
Versions 15 and later
GranularityAppointment
New in version 15
GranularityAppointment
GranularityAppointment
..GranularityAppointment allows you to find out and modify the precision of the grid used by the Organizer control or by the Scheduler control to define the appointments.
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 16 and later
MaskTitleDate
New in version 16
MaskTitleDate
MaskTitleDate
..MaskTitleDate is used to find out and modify the mask used for the title of the day columns in an Organizer control or in a Scheduler control.
Versions 17 and later
MovementAPT
New in version 17
MovementAPT
MovementAPT
..MovementAPT is used to find out and specify whether the user can move an appointment in a Scheduler control or in an Organizer control.
Versions 15 and later
NbDayDisplayed
New in version 15
NbDayDisplayed
NbDayDisplayed
..NbDayDisplayed is used to find out and modify the number of days displayed in an Organizer control or in a Scheduler control.
Versions 15 and later
Num1stDayOfTheWeek
New in version 15
Num1stDayOfTheWeek
Num1stDayOfTheWeek
..Num1stDayOfTheWeek is used to find out and modify the 1st day of the week displayed in:
  • a Calendar control.
  • an Organizer control.
  • a Scheduler control.
  • an edit control in Date format with Calendar.
Versions 17 and later
PeriodSelection
New in version 17
PeriodSelection
PeriodSelection
..PeriodSelection is used to find out and indicate whether the user can select a period in a Scheduler control or in an Organizer control.
Versions 16 and later
Resource
New in version 16
Resource
Resource
..Resource is used to:
  • find out the resources visible in a Scheduler control.
  • find out the resource of the Scheduler control corresponding to the specified subscript.
Versions 17 and later
ResourceHeight
New in version 17
ResourceHeight
ResourceHeight
..ResourceHeight is used to find out and modify the height of the resources in a Scheduler control where the resources are displayed in row.
Versions 17 and later
ResourceWidth
New in version 17
ResourceWidth
ResourceWidth
..ResourceWidth is used to find out and modify the width of resources in a Scheduler control where the resources are displayed in column.
Versions 16 and later
SelectedResource
New in version 16
SelectedResource
SelectedResource
..SelectedResource returns the name of the resource corresponding to the selection made by the user in a Scheduler control.
Versions 14 and later
StartDate
New in version 14
StartDate
StartDate
..StartDate is used to find out and modify the start date of the period selected:
  • in a Calendar control.
  • in an Organizer control.
  • in a Scheduler control.
Versions 15 and later
WorkingHourEnd
New in version 15
WorkingHourEnd
WorkingHourEnd
..WorkingHourEnd is used to find out and modify the end time of the working hours used:
  • by an Organizer control.
  • by a Scheduler control.
  • by a Gantt Chart column (in a Table or TreeView Table control).
Versions 15 and later
WorkingHourStart
New in version 15
WorkingHourStart
WorkingHourStart
..WorkingHourStart is used to find out and modify the start time of the working hours used:
  • by an Organizer control.
  • by a Scheduler control.
  • by a Gantt Chart column (in a Table or TreeView Table control).
To find out the entire list of WLanguage properties that can be used with a Scheduler control, see Properties associated with the Scheduler control.
Minimum required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment