Recent

Author Topic: ZVDateTimeCtrls 1.4 is released  (Read 45038 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: ZVDateTimeCtrls 1.4 is released
« Reply #15 on: October 12, 2013, 11:25:28 pm »
@JuhaManninen.  Have you looked at TCalendarLite?  It's not as developed as TZVDateTimePicker, but it has a lot of potential.  It handles different languages and RightToLeft beautifully and it's TINY!

http://forum.lazarus.freepascal.org/index.php/topic,21093.30.html
Lazarus Trunk / fpc 2.6.2 / Win32

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.4 is released
« Reply #16 on: October 13, 2013, 12:33:39 am »
New version 1.4 of ZVDateTimeCtrls package is released.
Well, 1.4 was new when this topic started, now more than year ago, there are new features in trunk, it's time to tag a new release. :D

How compatible is your component with VCL TDateTimePicker?
The main incompatibility is Format property which my control lacks. Display formatting is made through other properties.
Actually, my primary goal was to make final user's compatibility (the control looks and feels pretty same for final user), but the properties are not same.
There are also several improvements I added, which widen the incompatibility (editable date and time in same control instance - not possible in VCL, mouse wheel interaction, AutoAdvance property - when set to true, when user edits a date part, the selection jump to next date/time part...).
The other thing is that ZVDateTimePicker can not display month names (month is always a number).

Anyway, I believe that it would not be to difficult to make one-way conversion (as a part of Delphi convertor), for usable formats.
Here is what I mean: as VCL's Format property allows strange formats, for example MM-hh:yyyy/MM - month appears twice, hour between month and year, three different separators are used - this much freedom in formatting is not allowed here, so the convertor can recognize that we have month then year in date, then hour in time, also convertor will recognise that lower case h means 12-hour format, then the convertor will ignore the second apperance of month and we can get something like "mm-yyyy hh AM".

What would you say if this component was added to LCL and maintained in Lazarus repository? Maybe somebody has mentioned this possibility already, don't know. Then you would have write access to that directory obviously.
What about changing the name to TDateTimePicker then?

This would require acceptance from other developers, too. Now only me and Zeljan have mentioned this idea.

Of course I have no objection to this. I never liked adding my initials as prefix. I only put it in front of the control name because I thought that LCL developers might one day wrap native windows control (as VCL does), so that I should leave TDateTimePicker name free for them.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: ZVDateTimeCtrls 1.4 is released
« Reply #17 on: October 13, 2013, 11:30:19 am »
Well, 1.4 was new when this topic started, now more than year ago, there are new features in trunk, it's time to tag a new release. :D

Ok, I just quoted something without looking at the dates. The latest version would be used of course.

Quote
Anyway, I believe that it would not be to difficult to make one-way conversion (as a part of Delphi convertor), for usable formats.
Here is what I mean: as VCL's Format property allows strange formats, for example MM-hh:yyyy/MM - month appears twice, hour between month and year, three different separators are used - this much freedom in formatting is not allowed here, so the convertor can recognize that we have month then year in date, then hour in time, also convertor will recognise that lower case h means 12-hour format, then the convertor will ignore the second apperance of month and we can get something like "mm-yyyy hh AM".

In future the converter may be able to do things like that. Some missing feature in LCL component is OK though, and it can be implemented later.

Quote
Of course I have no objection to this. I never liked adding my initials as prefix. I only put it in front of the control name because I thought that LCL developers might one day wrap native windows control (as VCL does), so that I should leave TDateTimePicker name free for them.

Ok, this is a valid point. In Delphi this component is a COM control wrapper. Such wrappers are nasty. I looked at the TCoolbar wrapper and uhhh, it is bad, and they never got it working properly at design time.
Binding complex components to native widgets is difficult because of all the differences, even without the COM control challenge.
IMO the right way is to make a practically custom drawn version for such controls as I did with TCoolbar. Your TDateTimePicker would fit there, too.

Other issue is which components should be included in LCL and which should be kept in external repositories like CCR.
LCL is meant to be more or less VCL compatible. TDateTimePicker matches that rule.
Other useful but non-VCL components are a grey area. For example the Industrial library (Led etc.) that I added is useful and does not compete with other LCL components. Yet, there are many other libs that fill the same criteria. Should they all be included? No, then we would compete directly with CodeTyphon.
The right solution instead is to make installation of external components as easy as possible. There is some pre-alpha code (Aarre) but nothing functional. I think it should be derived from fppkg somehow. Volunteers would be needed here, too, like for many other tasks.
I believe the Industrial lib will be moved to CCR once the installation from there is easy.

So, a rule of thumb is that a component should go to LCL only if it is VCL compatible or it is needed by Lazarus IDE itself.

Avishai, TCalendarLite does not fulfill those requirements. The goal however is to make downloading and installing such components easier.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: ZVDateTimeCtrls 1.4 is released
« Reply #18 on: October 13, 2013, 11:41:08 am »
I wasn't suggesting to use TCalendarLite as LCL, only pointing out that it is a very nice beginning for a component.  With a little work it could be outstanding.
Lazarus Trunk / fpc 2.6.2 / Win32

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.4 is released
« Reply #19 on: October 13, 2013, 08:32:32 pm »
I wasn't suggesting to use TCalendarLite as LCL, only pointing out that it is a very nice beginning for a component.  With a little work it could be outstanding.

Avishai, if LCL's TCalendar has no support for right-to-left, then ZVDateTimePicker also has this problem, as it uses TCalendar. I do not know much about right to left, but tell me please, apart from the calendar control, are there more problems that ZVDateTimePicker has with right-to-left languages? I am interested in improving the control for right-to-left support.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: ZVDateTimeCtrls 1.4 is released
« Reply #20 on: October 13, 2013, 09:42:15 pm »
Zoran, I will have to look at ZVDateTimePicker more closely to give you a good answer.  But for one thing, no matter what language TCalendar uses for Month and Day names, AFAIK the word "Today" does not change to that language.  It stays "Today" and I have not found a way to change it.  So for me, TCalendar is an English-Only control. 

I will try to take a close look at ZVDateTimePicker tomorrow and give you a more complete answer.
Lazarus Trunk / fpc 2.6.2 / Win32

GADZombie

  • New Member
  • *
  • Posts: 46
  • 8bitrlz
    • Zombie Mastah
Re: ZVDateTimeCtrls 1.4 is released
« Reply #21 on: October 14, 2013, 09:00:17 am »
Now implemented. There is new property HideDateTimeParts, where you can set individual date/time parts to be hidden.

Thank you! I'll try it today!

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: ZVDateTimeCtrls 1.4 is released
« Reply #22 on: October 14, 2013, 02:25:04 pm »
Zoran, I took a look at TZVDateTimePicker from a RightToLeft point of view.  I even made a brief attempt at mirroring TCalendar (Windows only) but failed.  It wouldn't help anyway because of the issue with the word "Today".  Other than that problem I didn't find anything major that couldn't be handled easily.

As for what a R2L calendar SHOULD look like, take a look at TCanendarLite and set it to Hebrew.  The guys that wrote it did an outstanding job of it.  It needs further development, but it's pretty impressive - and tiny.

There are many different calendars in the world.  But for business and social reasons pretty much the entire world uses the common secular calendar.  The only difference being the text language and whether it is L2R or R2L.
Lazarus Trunk / fpc 2.6.2 / Win32

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.4 is released
« Reply #23 on: October 14, 2013, 03:19:27 pm »
Zoran, I took a look at TZVDateTimePicker from a RightToLeft point of view.  I even made a brief attempt at mirroring TCalendar (Windows only) but failed.  It wouldn't help anyway because of the issue with the word "Today".  Other than that problem I didn't find anything major that couldn't be handled easily.

As for what a R2L calendar SHOULD look like, take a look at TCanendarLite and set it to Hebrew.  The guys that wrote it did an outstanding job of it.  It needs further development, but it's pretty impressive - and tiny.

There are many different calendars in the world.  But for business and social reasons pretty much the entire world uses the common secular calendar.  The only difference being the text language and whether it is L2R or R2L.

Okay, thanks, so there is nothing about the appearance of the control itself (apart from the calendar) that should be changed for rigth-to-left support. That is what I wanted to know.
The calendar control, used by ZVDateTimePicker, is another story. Although ZVDateTimePicker will always use LCL's TCalendar as default and the only one provided "as is", now I'm thinking about the system which will make it very simple to easily replace TCalendar with some other calendar component (you can use then TCalendarLite or any other). Just wait a while for it, I have some ideas. ;)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: ZVDateTimeCtrls 1.4 is released
« Reply #24 on: October 14, 2013, 03:42:52 pm »
Quote
now I'm thinking about the system which will make it very simple to easily replace TCalendar with some other calendar component...

Zoran, thats sounds like a good idea.

As for the TZVDateTimePicker itself, when it is R2L the control should be reversed.  For example with ComboBox style, the Down Arrow should be on the Left and the text Right Aligned.
Lazarus Trunk / fpc 2.6.2 / Win32

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.4 is released
« Reply #25 on: October 14, 2013, 09:41:48 pm »
Quote
now I'm thinking about the system which will make it very simple to easily replace TCalendar with some other calendar component...

Zoran, thats sounds like a good idea.

As for the TZVDateTimePicker itself, when it is R2L the control should be reversed.  For example with ComboBox style, the Down Arrow should be on the Left and the text Right Aligned.

I see. It's on to-do list.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.4 is released
« Reply #26 on: October 15, 2013, 01:04:55 pm »
I added BiDiMode and ParentBiDiMode properties in published section.

Now, when BidiMode is set to right-to-left, the button or up-down control are on the left, CheckBox is on the right, the text is right-aligned.

Also, take a look at the component editor, when control has BiDiMode right-to-left. 8)

Avishai, please test, I have no experience with right-to-left languages, so your comments are precious to me.
And tell me please, how the numbers should be entered when user types? Please test the behaviour with AutoAdvance set to True. Should the selection movement also be reversed?

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: ZVDateTimeCtrls 1.4 is released
« Reply #27 on: October 15, 2013, 01:41:11 pm »
Awesome  :D  Thank you so much!  I tested with and without AutoAdvance and it looks perfect.  And the Calendar DropDown goes the right way as well.  Very impressive.  As for the direction of numbers, BiDiMode usually takes care of that.

BiDi is short for Bidirectional.  Alfa chars and punctuation go RightToLeft and numbers go LeftToRight.  It has to do with the internationalization of Mathematics.  The rest of the explanation is too boring so I'll leave it at that.

Edit: Avishai! 123 = אבישי! 123
« Last Edit: October 15, 2013, 02:20:40 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.4 is released
« Reply #28 on: October 15, 2013, 02:03:56 pm »
Awesome  :D  Thank you so much!  I tested with and without AutoAdvance and it looks perfect.  And the Calendar DropDown goes the right way as well.  Very impressive.  As for the direction of numbers, BiDiMode usually takes care of that.

BiDi is short for Bidirectional.  Alfa chars and punctuation go RightToLeft and numbers go LeftToRight.  It has to do with the internationalization of Mathematics.  The rest of the explanation is too boring so I'll leave it at that.

Thank you for quick response! Please tell if you notice anything else.
Now I'm plunging into plans I mentioned above, about the calendar control.

grandehombre

  • New Member
  • *
  • Posts: 42
Re: ZVDateTimeCtrls 1.4 is released
« Reply #29 on: October 18, 2013, 01:58:37 pm »
Thanks Zoran.
My apologies, I missed your reply and did not see it until today.

I have since modified my copy of the control to behave the way I need it for this particular application, so all is well.

Thanks again for a great component.

Cheers,
Nick



Hello, Grandehombre, I am very sorry that I haven't answered to this post before.

If the user unchecks a checked checkbox, the displayed date shows as NULL (correctly).
No, it does not show as NULL, it has nothing to do with checkbox! The behaviour you are describing is not what I have here.
And it is not the intended behaviour, the state of the checkbox is not connected to value in database. The purpose of the checkbox (as described here) is to allow or forbid direct user interaction with date/time.

However, if you want to use the checbox for this purpose you can do it by programming OnCheckBoxChange event, something like this:

Code: [Select]
procedure TForm2.DBZVDateTimePicker3CheckBoxChange(Sender: TObject);
begin
  if (not DBZVDateTimePicker3.Checked) and (not DBZVDateTimePicker3.Field.IsNull) then begin
    DBZVDateTimePicker3.DataSource.DataSet.Edit;

    DBZVDateTimePicker3.Field.Value := Null;
  end;

end;

This should get the behaviour you want. However, I am not going to bind the check box to the value of underlying db field, it is certainly not what check box is intended to do.
Lazarus v1.2RC2  i386-win32-win32/win64,  FPC v2.6.2, svn43696 on Win7-64 and win8.1

 

TinyPortal © 2005-2018