Visual components as a natural part of a Delphi application

For me, as a long time Delphi developer, custom made Visual components have not been a part of my Delphi VCL applications, nor my various frameworks that’s evolved over the years. Not that I don’t know how to create a visual component using VCL, but it’s just to much work, I think, to bother.

But there’s been many times when it would have been nice to have a panel loaded with some labels or edits just to plunk onto a form.

As I’ve moved over to the FMX frame work, this attitude followed me, and I also expanded it into thinking that using the FMX style frame work is kind of a drag and requires a lot of fidgeting to get it working the way you want.

I was wrong. In both regards.

A few FMX projects along, I seem to start evolving into actually adding application specific styled visual components to my projects. For instance, if I want some specific information to be shown in a list or on a scroller, I’d have to programmatically create a panel and with code add all the labels onto it and finally stick that panel in the scroller. Quite cumbersome business and the produced code most often isn’t very beautiful to look at.

So, after having read Andrea Magni’s blog that I’ve referred to in previous posts, I’m actually learning how easy it is to do just such a panel in FMX. The last one I did was a couple of days ago and I whisked the following component together on my buss ride home (about 45 minutes).

wppanelexample.png

Much to my surprise, now I usually find myself adding a package project to my project groups (I have almost never even used packages before) that holds my various styled controls that I use in my apps. They’re to specialized to use in a wide range of projects (I have other places for those that are not), so they sit in the project group and are sometime (but not always) installed as components in the IDE.

Most of these components are created programmatically at run time, so they don’t really need to be installed in the IDE, but some actually are. With a good naming strategy and a healthy separation I don’t think they will interfere too much with other stuff.

I encourage every Delphi developer firstly to check out the FMX frame work, but also have a look at how to work with specialized styled controls for your various apps. They can be a very good time saver and makes for rather good separations in your apps.

Leave a Reply

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