Forum > LCL

my attempt at a new component

(1/1)

magu:

I am working on a component to easily allow the selection of specific days or ranges of days mainly for use with a table of data so you can select either one specific date or a range of dates: it shows the date as a drop down list and allows easy switching between single dates and ranges.

The component is below usage is quite straightforward.
Drop the control in the form and the following control the information flow:
OnChange - is triggered if a change occurs to a date in the selection.
DateStart - the starting date (Tdate)
DateEnd - the ending date (Tdate)
DateIsARange - is DateEnd > DateStart (Boolean).

At this stage it does work (sort of) well enough for my purposes however I would be super grateful if you could look at it and give any suggestions / criticisms / actual help to improve this.

MiquelMus:
Hello Magu.

I have installed your component on my computer, and found it very useful.

The main idea you have conveyed in your presentation (I think) is that in a single component you can write a simple date or a composite 'Start Date' / 'End Date', all in one component.

I have to say that the idea seems to me brilliant and its execution in the component is correct.

I have tested it on my computer located at home in Barcelona (Spain).

Due to language differences, dates appear with mixed English / Spanish words, such as "Today, Sábado 21 de enero de 2023", I only comment it for your knowledge.

And since you ask for some idea of possible improvement, maybe you can add in the drop-down list the quarter (in Spain, many taxes have quarterly periodicity).

I attach images of how it looks in my computer.

Greetings.
Miquel

magu:
Thanks for your comments,
You are right I need to include a way to change the options to be localised as well as to select which options are available. Not really too sure how to do it, but it will be a good learning exercise so I'll try ;)
In the meantime I made a few small improvements to the component.

avra:

--- Quote from: magu on January 22, 2023, 12:06:49 am ---I need to include a way to change the options to be localised as well as to select which options are available. Not really too sure how to do it, but it will be a good learning exercise so I'll try ;)
--- End quote ---
You are probably overthinking this one. There are not many strings to localize, so why don't you simply provide them as properties, and user can change them in his IDE if he wants. If user provides localization for his application, he will provide it also for your component strings.

magu:
Hello,
I have introduced both options to view quarters. it is also possible to change the text of the various options, you need to use the following in the gui:
 FDateOptions :: is a StringList which contains all the options (so far the system nows which option is chosing depending on its index position. So the order you use is important. If you want to change the Order you need to change the enum : TCustomLangDateOptions (found in the unit)
 I need to find a way to make it agnostic but not sure how to do that so far.
 ps when modifying options you can use the flags %shortdate1, %longdate1 to control how actual dates will be displayed on the drop down.
 FFormatDateSettings :: is the dateformat settings that will be displayed when a verbose date is displayed.
 FFormatDateRangeSettings :: is the dateformat setting when a short date is displayed.
 

Navigation

[0] Message Index

Go to full version