VCL.Windows 10 Calendar Sample
This sample shows how to use Windows api.
Contents
Location
You can find the Windows 10 Calendar sample project at:
- Start | Programs | Embarcadero RAD Studio 10 Seattle | Samples and then navigate to:
Object Pascal\VCL\Windows 10 Calendar
- Subversion Repository:
Description
The purpose of this sample is to show how to use the Windows API. As en example, this project uses the WinAPI to access different calendars types.
The sample displays the current system date in the provided language, and displays information of four the different calendar systems: Gregorian, Japanese, Hebrew, and Hijri. The sample uses locales to show the calendar data in different formats.
How to Use the Sample
- Navigate to the location given above and open: ProjectCalendar.dproj.
- Select 32-bit Windows or 64-bit Windows as target platform.
- Note: This sample is only compatible with Windows 10.
- Press F9 or choose Run > Run.
- Click the Show Data button to display the information.
- You can use the Clear Memo button to wipe the information.
- Use the EditLanguage TEdit to change the language by typing for example
es-ES
ortk-TM
.
The EditLanguage TEdit expects the Windows locale name, this is either the language code (ISO_639-1), such as en
, es
, ar
, and so on; or the language code in combination with the country code (ISO 3166-1) such as en-US
, es-ES
, and ar-SA
.
Files
File | Contains |
---|---|
ProjectCalendar.dproj |
The project itself. |
FCalendar.dfm |
The main VCL form where the components are located. |
FCalendar.pas |
Used to define and implement the sample. |
UCommonTypes.pas |
Another unit used to implement the |
Classes
The UCommonTypes.pas
unit implements the following classes:
- The iterator class
TIteratorArrayOfHstring
. - The vector and iterable class
TArrayOfHString
.
The above two classes implement the interfaces IIterator_1__HSTRING
; and IVector_1__HSTRING
and IIterable_1__HSTRING
respectively.
Implementation
The sample displays the information of the calendars in a TMemo.
TCalendarIdentifiers
is used to set the different calendar systems: Gregorian
, Japanese
, Hebrew
, and Hijri
.
The sample uses the ICalendar
interface to show the current date of the system in the different calendar systems, as well as specific information from the four calendar systems.
Uses
The main units used in this sample are:
Winapi.Globalization.pas
Winapi.WinRT.pas
Winapi.Foundation.Collections.pas