Recent

Author Topic: my attempt at a new component  (Read 937 times)

magu

  • New Member
  • *
  • Posts: 36
my attempt at a new component
« on: January 20, 2023, 10:50:21 pm »

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

  • Newbie
  • Posts: 6
Re: my attempt at a new component
« Reply #1 on: January 21, 2023, 01:10:32 am »
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
« Last Edit: January 23, 2023, 09:39:04 am by MiquelMus »

magu

  • New Member
  • *
  • Posts: 36
Re: my attempt at a new component
« Reply #2 on: January 22, 2023, 12:06:49 am »
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

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: my attempt at a new component
« Reply #3 on: January 23, 2023, 07:17:36 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 ;)
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.
« Last Edit: January 23, 2023, 07:20:05 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

magu

  • New Member
  • *
  • Posts: 36
Re: my attempt at a new component
« Reply #4 on: February 10, 2023, 09:27:41 pm »
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.
 

 

TinyPortal © 2005-2018