Problem: How to use the Gmail FireDAC Enterprise Connector
Solution tested on C++ Builder 10.2.3
CData is a company with a clever idea. It writes drivers that connect to various technologies and make them appear as if they were databases. Thus, knowing only SQL, you can read a CVS file, use Google’s Gmail, search with Microsoft’s Bing, link in to LinkedIn, and do many other things. CData and Embarcadero have partnered to create wrappers for these drivers in the form of components that you can use in both VCL and FireMonkey programs. Embarcadero calls these Enterprise Connectors. The rest of this post is a demonstration of how to use the Gmail enterprise connector in a VCL program. If you’d rather just see a summary of tips for using the connector, scroll down to the end of this post. If you’d like more background on enterprise connectors, see this post.
Continue reading “Using CData’s Gmail connector in C++ Builder”
Problem: How to use the CSV FireDAC Enterprise Connector
Solution tested on C++ Builder 10.2.2
CData is a company that makes drivers for databases. Although this may sound like a useful but prosaic product, CData has a clever twist. Their mantra is “See the world as a database” and their products take this to heart. They allow you to view many things that aren’t databases as if they were. Examples include accessing sites such as eBay, Instagram, Facebook, Twitter and Gmail; working with programs like QuickBooks, Google Sheets, Microsoft Office 365; and manipulating data that is in generic formats, such as JSON, XML and CSV. The idea is that by using just SQL you can now accomplish a lot more than querying databases. Well, that’s nice, but what does it have to do with Builder?
Continue reading “Using CData’s CSV connector in C++ Builder”
Problem: IDE won’t let you set certain default layouts
Solution tested on RAD Studio 10.2
An IDE desktop layout is a file that records the positions, sizes, contents and visibility of IDE windows. In the RAD Studio main menu bar, selecting View and then Desktops produces a sub-menu of operations related to IDE desktop layouts. One item is Set Debug Desktop, which lets you save the desktop layout that the IDE will use during run-time, i.e., when you’re running a program that you launched from within the IDE. Unfortunately, there are no similar provisions for setting the startup layout or the default layout. Here is how you can do it though.
Continue reading “Setting the default and startup layouts in RAD Studio”
Problem: FMX progress bar won’t update
Solution tested on C++ Builder 10.2
Suppose you’re doing a long calculation that doesn’t involve FireMonkey components. You’d like to update the user with a progress bar. You periodically take a break in the computations to update the progress bar. However, when you run your program, the progress bar doesn’t move.
The solution is to call
Application->ProcessMessages() after updating the progress bar.
Application is a global variable present in all FireMonkey programs. The code below is an example of the problem and its solution. (By the way, this problem also occurs with the animation indicator and other GUI elements such as a label, and you can solve it with the same technique.)
Continue reading “Updating a progress bar during long calculations”
In the previous part of this tutorial we downloaded and set up Howard Hinnant‘s date library. This is a library written in standard C++ that lets us work with dates much more easily than what we can currently do. We learned how to work around some potential compiler errors and how to create compile-time and run-time dates. In this part of the tutorial we’ll discuss the library’s error handling and efficiency, and then concentrate on doing calculations with the dates.
Continue reading “Tutorial Part 2- A Portable Date Library for C++”
How do we work with dates and times in C++? One way is to use the C date and time library. This library has functions for manipulating times, such as
difftime; functions for converting formats of times and dates, e.g.,
mktime; and various types, such as
tm for calendar time,
time_t for the time since the epoch, and
clock_t, which denotes a process running time. In addition, since C++11 we’ve had a nice library for dealing with points in and durations of time, namely,
These libraries do have their problems though. The C library (not surprisingly) looks like just that – a C library, and not like C++ code. For example, it has no classes, there are no operators for performing such useful functions as determining the amount of time between two dates or whether one date comes before or after another date, and the internals of the library are exposed and often clumsy to work with. The
chrono library overcomes these deficiencies because it was designed from the ground up to be in C++. Unfortunately,
chrono has no facilities for working with calendar dates.
Continue reading “Tutorial Part 1- A Portable Date Library for C++”