|
|
|
|
|
- Overview
- Manipulating Scheduler controls programmatically
- Adding a resource
- Adding an appointment
- Populating a Scheduler control with the data from an 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 control display options
- Handling an appointment programmatically
- Using the context menu (AAF)
- Advanced use of events associated with the Scheduler control
- Advanced use of events with procedures
- Management of public holidays
- Properties specific to Scheduler controls
Manipulating Scheduler controls programmatically
A Scheduler control can be: This help page explains how to programmatically manipulate Scheduler controls. The following example is used to store appointments in an HFSQL database.
Manipulating Scheduler controls programmatically Adding a resource Adding a resource into a Scheduler control is performed by SchedulerAddResource. This resource can correspond to a person, a room, ... Example:
SchedulerAddResource(SCH_Schedule1, "Florence" + gStoredValue("FL"))
SchedulerAddResource(SCH_Schedule1, "Emma" + gStoredValue("EM"))
SchedulerAddResource(SCH_Schedule1, "Fred" + gStoredValue("FR"))
In this example, gStoredValue is used to propose a displayed resource ("Florence", for example) and a resource handled through programming ("FL", for example).
Adding an appointment Adding an appointment into a Scheduler control is performed by SchedulerAddAppointment. This function accepts two syntaxes: - syntax for specifying appointment features: title, description, ...
Example:
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 a variable of type Appointment.
Example:
MyAppointment is 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
SchedulerAddAppointment(SCH_Schedule, MyAppointment)
The BackgroundColor 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. Populating a Scheduler control with the data from an HFSQL data file The records are stored in an HFSQL data 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.
MyAppointment is Appointment
FOR EACH APT
MyAppointment.Title = APT.Title
MyAppointment.Content = APT.Content
MyAppointment.StartDate = APT.StartDate
MyAppointment.EndDate = APT.EndDate
MyAppointment.Category = APT.Category
MyAppointment.ID = APT.APTID
SchedulerAddAppointment(SCH_MySchedule, MyAppointment)
END
Retrieving a list of appointments - the list of all the appointments found in the Scheduler control.
For example:
arrAppointmentList is array of Appointment
arrAppointmentList = SchedulerListAppointment(SCH_MySchedule)
- the list of appointments for a resource included between two dates.
For example:
arrAppointmentList is array of Appointment
arrAppointmentList = SchedulerListAppointment(SCH_MyScheduler, MyResource, ...
"20200101", "20200131")
- the appointment currently selected or hovered.
For example:
arrAppointmentList is array of Appointment
arrAppointmentList = SchedulerListAppointment(SCH_MyScheduler, schAptSelected)
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:
SchedulerPositionDateTime(SCH_Schedule, Today())
Deleting an appointment - the appointment selected in the control.
- a specific appointment.
SchedulerDeleteAppointment(SCH_Schedule, 1)
Deleting a resource SchedulerDeleteResource is used to delete a resource from the Scheduler control.
ResDel is boolean
ResDel = SchedulerDeleteResource(SCH_Schedule1, "Flo")
IF ResDel = True THEN
Info("Resource deleted")
END
SchedulerDeleteAll deletes all the appointments from the Scheduler control as well as all its resources. Modifying the control display options The current display of a Scheduler control can be modified via the following functions: Handling an appointment programmatically You have the ability to handle an appointment through programming: - by using the index of the appointment to modify.
- by pointing by reference on the appointment to modify.
1. Using the index Each time an appointment is added to a schedule, SchedulerAddAppointment returns an index. This index represents the added appointment. This index can be used to handle the appointment directly. Example: APTNum is int
APTNum = 5
SCH_ROOM[APTNum].Title = "Blue room"
2. Using a reference To manipulate 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: TO is Appointment
TO <- SCH_Room[APTNum]
TO.Title = "New title"
Using the context menu (AAF) Advanced use of events associated with the Scheduler control Advanced use of events with procedures 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, simply open the window or the page in the "Entry in edit in an appointment" event. To lock the direct input, the event must return False.
Example: Opening an appointment entry window.
PROCEDURE Edit(aptEdited is Appointment)
Open(WIN_InputAPT_HFSQL, aptEdited)
RETURN False
Management of public holidays Public holidays can be set programmatically. Several WLanguage functions (starting with BankHolidayXXX) are available. To define the public holidays displayed in Organizer, Scheduler and Calendar controls, use BankHolidayAdd. This function allows you to define the list of public holidays to be used. This function allows you to customize the public holidays according to the country and local regulations. This function must be used at the beginning of the application because it has a global effect on the application. Public holidays will be in green in the schedule. Example:
BankHolidayDeleteAll()
BankHolidayAdd("0101")
BankHolidayAdd(bhEasterMonday)
BankHolidayAdd("0501")
BankHolidayAdd("0508")
BankHolidayAdd(bhAscensionDay)
BankHolidayAdd(bhWhitMonday)
BankHolidayAdd("0714")
BankHolidayAdd("0815")
BankHolidayAdd("1101")
BankHolidayAdd("1111")
BankHolidayAdd("1225")
BankHolidayAdd("1226" + CR + bhGoodFriday)
Properties specific to Scheduler controls The following properties are specific to Scheduler control by programming.
| | DayBreakHeight | La propiedad DayBreakHeight obtiene y establece la altura de las pausas entre días en un control Planificador en el que los días están ordenados en filas y los recursos en columnas. | DayHeight | La propiedad DayHeight obtiene y establece la altura de los días en un control Planificador donde los días están ordenados en filas, y los recursos están ordenados en columnas. | DayWidth | La propiedad DayWidth se utiliza para determinar y cambiar el ancho de los días: - en un control Planificador donde los días se muestran por columnas y los recursos en filas.
- en una columna del diagrama de Gantt.
| DirectInputAPT | La propiedad DirectInputAPT se utiliza para determinar y especificar si el usuario puede cambiar directamente el título de una cita en un control Planificador u Organizador. | EndDate | La propiedad EndDate obtiene y establece la fecha de finalización del período de tiempo seleccionado: - en un control Calendario,
- en un control Agenda.
- en un control Planificador.
| GranularityAppointment | The GranularityAppointment gets and changes the precision of the grid used to define appointments in Organizer or Scheduler controls.
Property retained by compatibility. | 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 GranularityMovement property gets and sets the size of the grid to move: - appointments in an Organizer control.
- appointments in a Scheduler control.
- events in a TimeLine control.
- tasks in a Gantt Chart column.
| MaskTitleDate | The MaskTitleDate property is used to identify and change the input mask used for the title of day columns in Organizer or Scheduler controls | MovementAPT | La propiedad MovementAPT permite saber y especificar si los usuarios pueden mover citas en un control Planificador o Agenda. | NbDayDisplayed | The NbDayDisplayed property is used to: - get and change the number of days displayed in an Organizer or Scheduler control.
- get the number of days displayed in a Gantt Chart control in a report.
| Num1stDayOfTheWeek | La propiedad Num1stDayOfTheWeek obtiene y establece el primer día de la semana que se muestra en:- un control Calendario.
- un control Agenda.
- un control Planificador.
- un control Campo de entrada en formato de fecha con calendario.
| PeriodSelection | La propiedad PeriodSelection se utiliza para determinar y especificar si el usuario puede seleccionar un periodo de tiempo en un control Planificador u Organizador. | Resource | The Resource property is used to: - find out the resources visible in a Scheduler control.
- find out the resource of the Scheduler control that corresponds to the specified index.
| ResourceHeight | El ResourceHeight Property obtiene y establece la altura de los recursos en un control Planificador donde los recursos están dispuestos en filas. | ResourceWidth | La propiedad ResourceWidth obtiene y establece el ancho de los recursos en un control Planificador donde los recursos están ordenados en columnas. | SelectedResource | La propiedad SelectedResource devuelve el nombre del recurso que corresponde a la selección del usuario en un control Planificador. | StartDate | La propiedad StartDate permite determinar y cambiar la fecha de inicio del período de tiempo seleccionado:- en un control Calendario.
- en un control Agenda.
- en un control Planificador.
| WorkingHourEnd | La propiedad WorkingHourEnd se utiliza para identificar y modificar la hora de finalización de las horas de trabajo utilizadas:- por un control Agenda.
- mediante un control Planificador.
- por una columna Diagrama de Gantt (en un control Tabla o TreeView Table).
| WorkingHourStart | La propiedad WorkingHourStart obtiene y establece la hora de inicio de las horas de trabajo utilizadas: - por un control Agenda.
- mediante un control Planificador.
- por una columna Diagrama de Gantt (en un control Tabla o TreeView Table).
|
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|