Recent

Author Topic: ZVDateTimeCtrls 1.3 is released  (Read 28747 times)

Zoran

  • Hero Member
  • *****
  • Posts: 1975
    • http://wiki.lazarus.freepascal.org/User:Zoran
ZVDateTimeCtrls 1.3 is released
« on: April 03, 2011, 09:18:38 pm »
New version 1.3 of ZVDateTimeCtrls package is released.

The code is much simplified, the ZVDateTimePicker control is now "lighter".
The autosizing is also improved.

Code also had to be updated to fix the problems which appeared due to changes in Lazarus svn trunk, so the new version of the controls was needed.

Tested with Lazarus 0.9.30 (stable version) and 0.9.31 (trunk version); on Win XP, Win 7, Ubuntu 10.10.

The Wiki page: http://wiki.lazarus.freepascal.org/ZVDateTimeControls_Package

Download from Lazarus-ccr
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

zeljko

  • Hero Member
  • *****
  • Posts: 1811
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: ZVDateTimeCtrls 1.3 is released
« Reply #1 on: April 03, 2011, 09:46:33 pm »
Good job ! :)

JD

  • Hero Member
  • *****
  • Posts: 1908
Re: ZVDateTimeCtrls 1.3 is released
« Reply #2 on: April 04, 2011, 12:42:15 am »
Very good job!

I notice that the height of the component cannot be changed at design time but at runtime, it shrinks to the standard height of a TEdit. Is this deliberate?

I'm not complaining. In my opinion, it looks better that way on a form.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

Zoran

  • Hero Member
  • *****
  • Posts: 1975
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.3 is released
« Reply #3 on: April 04, 2011, 09:07:18 am »
Thank you, Željko and JD, I'm glad you like it!

I notice that the height of the component cannot be changed at design time but at runtime, it shrinks to the standard height of a TEdit. Is this deliberate?

I'm not complaining. In my opinion, it looks better that way on a form.

If Autosize property is set to True, then the height depends on the size of the font used (so yes, it behaves like TEdit). This is how it should behave in both designtime and runtime. Please describe more precisely the diference between how it behaves in design and runtime, I can't reproduce it.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis
Re: ZVDateTimeCtrls 1.3 is released
« Reply #4 on: April 04, 2011, 09:40:00 am »
Good job !
Congratulation!

JD

  • Hero Member
  • *****
  • Posts: 1908
Re: ZVDateTimeCtrls 1.3 is released
« Reply #5 on: April 04, 2011, 09:50:39 am »
@Zoran

It's OK. It was an oversight. I completely forgot the AutoSize property. I set it to False & I can now change the size of the control at designtime.

Have you tried to see if your controls can replace the standard Lazarus date/time controls? I use them all the time & they're really good.
« Last Edit: April 04, 2011, 09:53:34 am by JD »
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

Zoran

  • Hero Member
  • *****
  • Posts: 1975
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.3 is released
« Reply #6 on: April 04, 2011, 11:59:12 am »
@Zoran

It's OK. It was an oversight. I completely forgot the AutoSize property. I set it to False & I can now change the size of the control at designtime.

I prefer to set AutoSize to True. Then the size gets adjusted to the font used. Anyway, you should not experience any different autosizing behaviour in designtime and runtime. Please check if you rebuilt Lazarus IDE with new version of the package, I suspect that your IDE still uses old version. Please try to delete old versiion of the package and rebuld IDE.

Have you tried to see if your controls can replace the standard Lazarus date/time controls? I use them all the time & they're really good.

I haven't tried anything, but of course I would have no objections if Lazarus developers wanted to include it in LCL. I would be glad. That is not up to me, though. Anyway, you keep using it! :)
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

JD

  • Hero Member
  • *****
  • Posts: 1908
Re: ZVDateTimeCtrls 1.3 is released
« Reply #7 on: April 04, 2011, 12:56:52 pm »
I prefer to set AutoSize to True. Then the size gets adjusted to the font used. Anyway, you should not experience any different autosizing behaviour in designtime and runtime. Please check if you rebuilt Lazarus IDE with new version of the package, I suspect that your IDE still uses old version. Please try to delete old versiion of the package and rebuld IDE.

You're right. It is better to set AutoSize to True. I have applications using the default fonts on Windows XP (Tahoma size eight) & Vista/Win7 (Segoe UI size 9). When AutoSize is True, the font size does not look out of place with respect to the other controls.

I haven't tried anything, but of course I would have no objections if Lazarus developers wanted to include it in LCL. I would be glad. That is not up to me, though. Anyway, you keep using it! :)

I use it because it saves me the headache of validating date input by users - i.e testing for leap years, number of days in a month, assigning null dates, testing if a date exists etc. It gives me an iron grip on date input & keeps the date fields in my database sane.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

JanRoza

  • Hero Member
  • *****
  • Posts: 731
    • http://www.silentwings.nl
Re: ZVDateTimeCtrls 1.3 is released
« Reply #8 on: April 05, 2011, 10:15:25 pm »
Zoran,

Installed version 1.3 but on an older project I now have a compile error saying:
Quote
Error: identifier idents no member "Time"
The statement looks like:
Code: [Select]
strVluchtduur := TimeToStr(DB_Vluchtduur.Time);
DB_Vluchtduur is a DBZVDateTimePicker field showing only time (TimeDisplay tdHM).
Any idea what I'm doing wrong here?


 
OS: Windows 11 / Linux Mint 22.2
       Lazarus 4.4 RC FPC 3.2.2
       CodeTyphon 8.80 FPC 3.3.1

uli65

  • New Member
  • *
  • Posts: 13
Re: ZVDateTimeCtrls 1.3 is released
« Reply #9 on: April 06, 2011, 02:17:55 pm »
Very good job!!! But...direct typing of a date without separator characters (as in TDateEdit) is not possible?
Lazarus 2.0.6, FPC 3.0.4, Unidac 8.12

Zoran

  • Hero Member
  • *****
  • Posts: 1975
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.3 is released
« Reply #10 on: April 06, 2011, 08:34:07 pm »
Zoran,

Installed version 1.3 but on an older project I now have a compile error saying:
Quote
Error: identifier idents no member "Time"
The statement looks like:
Code: [Select]
strVluchtduur := TimeToStr(DB_Vluchtduur.Time);
DB_Vluchtduur is a DBZVDateTimePicker field showing only time (TimeDisplay tdHM).
Any idea what I'm doing wrong here?


Oh, yes, I know. :)
In version 1.0 of the control, property Time was accidentaly published in DBZVDateTimePicker control. The properties Date and Time should not be published in a DB aware control, so the property was removed in version 1.1 (take a look at ChangeLog.txt file enclosed with the package). Also, take a look at DBZVDateTimePicker.pas source file, comment on line 105, still there.

The purpose of a DB-aware control is user's interaction with a DB field. If you want to read or set a DB field in code, then you don't need a DB-aware contrlol, but you should use field object directly. That was my unintentional mistake to publish Time property in version 1.0 of DBZVDateTimePicker. This mistake was fixed in version 1.1 by removing this property.

I'm sorry for the incovinience. However, as I beleive that you use this control tied to a DB field (well, that's what it is for, or non-db ZVDateTimePicker should be used), you can use:
Code: [Select]
strVluchtduur := TimeToStr(Field1.AsDateTime);
where Field1 is the field to which DB_Vluchtduur is tied to.

Or:
Code: [Select]
strVluchtduur := TimeToStr(DB_Vluchtduur.DataSource.DataSet.FieldByName(DB_Vluchtduur.DataField).AsDateTime);

I hope this was helpful.

Zoran
« Last Edit: April 06, 2011, 09:06:27 pm by Zoran »
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Zoran

  • Hero Member
  • *****
  • Posts: 1975
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.3 is released
« Reply #11 on: April 06, 2011, 08:52:34 pm »
Very good job!!! But...direct typing of a date without separator characters (as in TDateEdit) is not possible?

No, you must press some key (right arrow, dash, dot, comma, slash...) to move the selection to another part of the displayed date / time.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

JanRoza

  • Hero Member
  • *****
  • Posts: 731
    • http://www.silentwings.nl
Re: ZVDateTimeCtrls 1.3 is released
« Reply #12 on: April 07, 2011, 12:27:14 am »
Thanks Zoran, your reply is very helpful.
I'll rework the project a bit to load the database datetime field to a non-db ZVDateTimePicker field and do my stuff on that field.
No need to apologize for the inconvenience, actually this will keep me out of the bar a little bit longer  :D
OS: Windows 11 / Linux Mint 22.2
       Lazarus 4.4 RC FPC 3.2.2
       CodeTyphon 8.80 FPC 3.3.1

Zoran

  • Hero Member
  • *****
  • Posts: 1975
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: ZVDateTimeCtrls 1.3 is released
« Reply #13 on: April 07, 2011, 01:11:52 pm »
I'll rework the project a bit to load the database datetime field to a non-db ZVDateTimePicker field and do my stuff on that field.

But if the control is tied to DB field, you should use DBZVDateTimePicker, that's what it is for, there is no reason not to!

I said that then you just don't need to read or write date or time from the control, you can use the field directly, can't you?

No need to apologize for the inconvenience, actually this will keep me out of the bar a little bit longer  :D

:D
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

JanRoza

  • Hero Member
  • *****
  • Posts: 731
    • http://www.silentwings.nl
Re: ZVDateTimeCtrls 1.3 is released
« Reply #14 on: April 07, 2011, 09:26:01 pm »
But if I use DBZVDateTimePicker then how can I substring (which propertie)?
I need to do some arithmatics with the hour and the minutes part and the Time property was perfect to use. Is there something like DBZVDateTimePicker.time or DBZVDateTimePicker.text I can operte on?
OS: Windows 11 / Linux Mint 22.2
       Lazarus 4.4 RC FPC 3.2.2
       CodeTyphon 8.80 FPC 3.3.1

 

TinyPortal © 2005-2018