Even years after switching from centralized version control to a decentralized one (or to be more precise: from Subversion to Mercurial) I still find myself stuffing different unrelated changes into one commit. Sometimes there are just some small changes to make the code compile in your current environment, sometimes you correct typos in the comments or string resources, sometimes it is just a better formatting of the code. All of these changes have nothing to do with the current bug to fix or the current feature to implement, but they end up being part of the commit – and that is just plain wrong! When it comes to commits, make them as small as possible! Continue reading “Bigger is not always better!”
Project Magician, Package Magician and Selective Debugging now support Delphi 10.4 Sydney.
As some of you might have guessed already, I have been a bit busy with the current beta of the new Delphi 10.4 Sidney. Usually one is not allowed to talk about the beta, but I have been given permission from Embarcadero to blog about some of the new features and improvements. Please note that everything said and shown here is from a pre-release version.
As David Millington already blogged about Redesigned Code Insight and Marco Cantú shared brought some newsabout Custom Managed Records, one of my personal favorites are the enhancements related to VCL styles.
In the past years quite a couple of my customers jumped on the VCL Style train as a simple and effective way to give their applications a fresh and modern look. Interestingly, most of them opted for an individual style tailored to match their corporate design.
One of these applications makes use of TMS Scripter to extend the standard functionality with customer designed forms. The Script Designer coming with Scripter is an extremely helpful tool in that.
Unfortunately the Script Designer doesn’t play well with the VCL style. That would be only a minor problem as the script design is not done very often and then mostly by the service staff. VCL styling is not critical for that. If we only could disable styling only for the designer form.
Now we can! Delphi 10.4 allows to set different styles per form and even per control.
That exactly solves the above problem. I can even imagine other use cases for having different styles even for controls on the same form. Some styles differ only marginally and this could be used to highlight several controls on a form more prominent than others.
This is a sample application with two forms. One form uses the native Windows style and the other uses the Windows10 Green VCL style. The VCL styled form contains two frames where one uses the Windows10 Blue style.
Another enhancement is the support for High DPI styles with the key feature of having different control entries for different sizes, backed up by bitmaps for different sizes. This is a sample project on a monitor with 100% scaling:
The button icons are taken from a TVirtualImagelist connected to a TImageCollection as it has already been available in Delphi 10.3 Rio. The two images to the left are shown with the new TVirtualImage control, that also takes its images from the same TImageCollection dynamically scaled to the size needed.
Delphi 10.4 Sidney – Get Excited!
In the previous blog post we learned how to decorate a field of a class with attributes to adjust the Json serialization to our needs. This post is about serializing fields of type TObjectList<T> or descendants thereof.
Serializing objects to Json as well as de-serializing them with the Delphi standard libraries has been subject to many discussions. While the majority suggests to use another library or a self implemented solution, there are others who would prefer the built-in tools for a couple of reasons. Simplicity and the availability with every (decent) Delphi installation being the most mentioned ones.
The ease and elegance of a TRESTRequest.AddBody<T>(myInstance) call is hard to attain with other means. I guess it is not myself alone being tempted to make use of it. With a bit of care taken when designing the objects to serialize the results are often quite satisfying and fit the requirements. Nourishing this with some advanced techniques shown in this post may be enough to keep the benefits without the need for external code. Continue reading “Serializing Objects with TJson”