Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
News

Making Win10 Calendar controls database-aware

the future of starts demands massive productivity

Author: Dmitry Kovalenko

Programming is fun. Sometimes projects and apps are more serious, sometimes less. On my recent Delphi 10.1 Update 2 presentation two times I have been asked about data-aware versions of new VCL Win10 calendar controls. Here is the code.

One of the best things about Delphi is that it comes with the source code. After a lot of googling for examples of custom database aware Delphi components, the actual source code of “TDBText” component in “VCL.DBCtrls” unit was the best resource.

The most important part of a custom data-aware field component is private “TFieldDataLink”. It does all the job, but as component implementer you need to expose its “DataSource” and “FieldName” properties. In the constructor there is also “OnDataChanged” event connected to “DataChanged” procedure. In this way the calendar control knows when it needs to refresh itself. This is centralized in the “GetFieldDate” method that reads the date from the internal “FDataLink.Field”.

Not a rocket science:-)

The source code of custom Win10 VCL data-aware components can be downloaded from this link.

The test application of data-aware “TCalendarView” and “TCalendarPicker” looks like this and is using RAD Studio InterBase “EMPLOYEE” database.

Let’s take a look at how you can create WinAPI Calendar in this article about RAD Studio 10.2.

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES