Releasing version 1.4

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2504 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
zoran-vucenovic
2012-09-05 08:30:42 +00:00
parent 093e2b2102
commit eaadaf9314
17 changed files with 5240 additions and 0 deletions

View File

@ -0,0 +1,481 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -0,0 +1,28 @@
The files in ZVDateControls package are under the modified LGPL,
same as the FPC RTL and the Lazarus LCL.
Copyright (C) Zoran Vučenović, http://wiki.lazarus.freepascal.org/User:Zoran
These files are distributed under the Library GNU General Public License
(see the file COPYING.LGPL) with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
The ZVDateControls package is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library (file COPYING.LGPL); if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

View File

@ -0,0 +1,68 @@
===================================================
Version 1.0 -- 27. Feb. 2010.
Initial release
===================================================
Version 1.1 -- 18. April 2010.
The Data aware control's (DBZVDateTimePicker's) interacting with DataSource is slightly improved.
There are also several fixes, these are some of them. The first three fixes apply to DBZVDateTimePicker control only, the fourth, fifth and sixth apply to both controls.
1. In runtime changing date/time in DBZVDateTimePicker was possible when not connected to database.
When not connected to specific DB field, or when the Database connection is not active, now the control can only have NULL value, which is appropriate behaviour for a DB control.
2. The Time property was accidentaly published in DBZVDateTimePicker. Time property, as well as Date, cannot be used directly in DBZVDateTimePicker, it is tied to underlying DB field.
The Time property is removed from published section of TDBZVDateTimePicker.
3. The DBZVDateTimePicker's properties MaxDate and MinDate were displayed as real numbers in Object inspector.
They are now displayed as dates.
4. The Hint property didn't work -- the hint didn't appear.
Now the Hint is shown when mouse pointer is over the control, of course only if ShowHint is set to True.
5. When calendar button is shown and AutoSize is False and the width is less than Text's width + SpeedButton's width, then the button gets hidden behind the text.
Now, the button is shown in front of the text, which is more appropriate behaviour.
6. When UpDown is shown and AutoSize is False, if Heigth is set to more than it would be if AutoSized, then, setting AutoSize to True would not trigger shirnking the control's Height as it should.
Fixed, now it does.
===================================================
Version 1.2 -- 12. May 2010.
Because of changes in LCL, some changes in code were needed, so that controls can compile with new Lazarus from svn trunk (since revision 25204).
===================================================
Version 1.3 -- 1. April 2011.
The changes of LCL, made after separating the 0.9.30 branch from the trunk, caused the crash of the control in new Lazarus 0.9.31 from trunk (see: http://wiki.freepascal.org/Lazarus_0.99.0_release_notes#Changes_affecting_compatibility), internal using of constructor TForm.Create had to be replaced by TForm.CreateNew (it was used twice -- for the drop-down form which carries the calendar and for design-time component editor form).
There are also internal changes which improved autosizing of the control.
The code is much simplified and the control is lighter now (there used to be an auxiliary control which is removed now and its code is simplified and unified in the main control).
===================================================
Version 1.4 -- 5. September 2012.
These are main changes:
The ZVDateTimeControls package is now in subversion control.
Added an event to interact with CheckBox -- OnCheckBoxChange (by Daniel S. Almeida).
OnChange event was triggered whenever date/time values change. Now it reacts only on changes made by user interaction, not when the changes are made programatically. The new behaviour is compatible with OnChange event of VCL's TDateTimePicker.
In Linux, locale-dependent properties were not initialized to correct defaults. Fixed now.
In Qt ws, the client rect of the control was not calculated correctly. Fixed now.
Plus many internal changes...

View File

@ -0,0 +1,426 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="LibreOffice 3.5 (Linux)">
<META NAME="AUTHOR" CONTENT="Zoran Vučenović">
<META NAME="CREATED" CONTENT="20100120;12052000">
<META NAME="CHANGED" CONTENT="20120904;23372000">
<STYLE TYPE="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
H4.cjk { font-family: "WenQuanYi Micro Hei" }
H4.ctl { font-family: "Mangal" }
A.cjk:link { so-language: zxx }
A.ctl:link { so-language: zxx }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>ZVDateTimeControls
Package for Lazarus</B></FONT></FONT></P>
<P ALIGN=CENTER STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><A CLASS="western" HREF="http://wiki.lazarus.freepascal.org/ZVDateTimeControls_Package"><FONT FACE="Arial, sans-serif"><FONT SIZE=3><SPAN LANG="en-US"><SPAN STYLE="font-weight: normal">http://wiki.lazarus.freepascal.org/ZVDateTimeControls_Package</SPAN></SPAN></FONT></FONT></A></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0cm"><BR>
</P>
<P ALIGN=CENTER STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0cm; font-weight: normal"><FONT FACE="Arial, sans-serif"><FONT SIZE=4>The
ZVDateTimeControls package contains two controls:</FONT></FONT></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0cm"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 2cm; margin-bottom: 0cm"><IMG SRC="pictures/TZVDateTimePicker.png" NAME="grafika2" ALIGN=BOTTOM WIDTH=24 HEIGHT=24 BORDER=0><A CLASS="western" HREF="#TZVDateTimePicker">
</A><A CLASS="western" HREF="#TZVDateTimePicker"><FONT FACE="Arial, sans-serif"><FONT SIZE=3><SPAN LANG="en-US"><SPAN STYLE="font-weight: normal">TZVDateTimePicker</SPAN></SPAN></FONT></FONT></A></P>
<P ALIGN=LEFT STYLE="margin-left: 2cm; margin-bottom: 0cm"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 2cm; margin-bottom: 0cm"><IMG SRC="pictures/TDBZVDateTimePicker.png" NAME="grafika5" ALIGN=BOTTOM WIDTH=24 HEIGHT=24 BORDER=0><A CLASS="western" HREF="#TDBZVDateTimePicker">
</A><A CLASS="western" HREF="#TDBZVDateTimePicker"><FONT FACE="Arial, sans-serif"><FONT SIZE=3><SPAN LANG="en-US"><SPAN STYLE="font-weight: normal">TDBZVDateTimePicker</SPAN></SPAN></FONT></FONT></A></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0cm"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>Author</B></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><A CLASS="western" HREF="http://wiki.lazarus.freepascal.org/User:Zoran"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US"><SPAN STYLE="font-weight: normal">Zoran
Vučenović</SPAN></SPAN></FONT></A></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>License</B></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">Modified LGPL, same as Lazarus
component library.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>Introduction</B></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">Delphi's
VCL has <A CLASS="western" HREF="http://docwiki.embarcadero.com/VCL/en/ComCtrls.TDateTimePicker">a
control named TDateTimePicker</A>, which I find very useful for
editing dates. LCL, however, does not have this control. Instead, for
editing dates <A CLASS="western" HREF="http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdateedit.html">LCL
has a control named TDateEdit</A>, but I prefer the VCL's
TDateTimePicker.</SPAN></FONT></P>
<P ALIGN=LEFT STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Therefore,
I tried to create a cross-platform Lazarus control which would
resemble VCL's TDateTimePicker as much as possible.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">The
TZVDateTimePicker control does not use <A CLASS="western" HREF="http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.aspx">native
Win control</A>. It descends from LCL's TCustomControl to be
cross-platform. It has been tested on Windows with win32/64 and qt
widgetsets, as well as on Linux with qt and gtk2 widgetsets.</SPAN></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Note
that the TZVDateTimePicker control does not descend from TEdit, so it
does not have unnecessary caret. The VCL's control doesn't have caret
either.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>Installation</B></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">To
install the package in Lazarus IDE follow these steps:</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<OL>
<OL>
<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Open
the package in Package Editor (in Lazarus' main menu click <I>Package</I>,
then <I>Open package file...</I> locate the file
zv<I>datetimectrls.lpk</I> and click <I>Open</I>).</FONT></P>
<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Compile
the package (click <I>Compile</I> in Package Editor's tool bar).</FONT></P>
<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Install
the package in the IDE (click <I>Install</I> – you will be asked
if you want to rebuild Lazarus, click <I>Yes</I>. Wait until
Lazarus rebuilds and restarts itself. The new tab “<I>Date and
Time Ctrls”</I> appears on the component palette with
TZVDateTimePicker and TDBZVDateTimePicker controls.</FONT></P>
</OL>
</OL>
<P STYLE="margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>Change
Log</B></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">For more details about changes, see
ChangeLog.txt</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">Version 1.0 – 27. February 2010.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">Version 1.1 – 17. April 2010.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">Version 1.2 – 12. May 2010.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">Version 1.3 – 1. April 2011.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-bottom: 0cm; font-weight: normal">
<FONT FACE="Arial, sans-serif">Version 1.4 – 4. September 2012.</FONT></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><A NAME="TZVDateTimePicker"></A><FONT FACE="Arial, sans-serif"><B>TZVDateTimePicker
<IMG SRC="pictures/TZVDateTimePicker.png" NAME="grafika9" ALIGN=MIDDLE WIDTH=24 HEIGHT=24 BORDER=0></B></FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>Properties:</B></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif">I'll explain some properties of
TZVDateTimePicker control: </FONT>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>DateTime: TDateTime (public)</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">The
DateTime value displayed on the control. This property is not
published in object inspector, but its value is actually the same as
Date and Time properties composed in one value. This property is
provided to allow setting or reading of both date and time value at
once in program code. In design time, Date and Time can be set in
object inspector. <A CLASS="western" HREF="#ZVDateTimePicker Editor">There
is also component editor</A> which provides easy way of setting this
property in design time.</SPAN></FONT></P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>Date: TDate</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">The
date displayed on the control which the user can edit.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>Time: TTime</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">The
time displayed on the control which the user can edit.</FONT></P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>MinDate: TDate</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">The
minimal date user can enter.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>MaxDate: TDate</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">The
maximal date user can enter.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm"><A NAME="NullInputAllowed"></A>
<FONT FACE="Arial, sans-serif"><B>NullInputAllowed: Boolean</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">When
True, the user can set the date to NullDate constant by pressing N
key.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>CenturyFrom: Word</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">When
user enters the year in two-digit format, then the CenturyFrom
property is used to determine which century the year belongs to. The
default is 1941, which means that when two digit years is entered, it
falls in interval 1941 – 2040. Note that MinDate and MaxDate
properties can also have influence on the decision – for example,
if the CenturyFrom is set to 1941 and MaxDate to 31. 12. 2010, if
user enters year 23, it will be set to 1923, because it can’t be
2033, due to MaxDate limit.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>Kind: TDateTimeKind</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>type</B>
TDateTimeKind = (dtkDate, dtkTime, dtkDateTime);</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">The
control displays only date, only time or both.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><IMG SRC="pictures/ZVDateControls03.PNG" NAME="grafika4" ALIGN=BOTTOM WIDTH=332 HEIGHT=40 BORDER=0></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>DateMode: TDTDateMode</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>type</B>
TDTDateMode = (dmComboBox, dmUpDown, dmNone);</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">When
DateMode is set to dmComboBox, there is a button on the right side of
the control. When user clicks the button, <A CLASS="western" HREF="http://lazarus-ccr.sourceforge.net/docs/lcl/calendar/tcalendar.html">the
calendar control</A> is shown, allowing the user to pick the date.
When set to dmUpDown, then UpDown buttons are shown.</SPAN></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">In
my opinion the UpDown buttons aren't really useful in this control,
they are provided for compatibility with Delphi's TDateTimePicker. Up
and down keys can always serve for same purpose, so can mouse wheel.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">In
the next picture the first control's DateMode is set to dmComboBox
and the second control's to dmUpDown.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><IMG SRC="pictures/ZVDateControls01.PNG" NAME="grafika1" ALIGN=BOTTOM WIDTH=151 HEIGHT=72 BORDER=0></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">If
DateMode is dmComboBox, when the user clicks on the button a calendar
drops down, allowing the user to pick a date.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>Note:</B>
if Kind property is set to dtkTime, the calendar control is
pointless. Therefore, if DateMode is dmComboBox, the UpDown is shown
instead.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>ShowCheckBox: Boolean</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">When
set, there is a check box on the left side of the control. When
unchecked, the display appears grayed and user interaction with the
date or time is not possible. (The control is still enabled, though,
only in sense that the check box remains enabled).</FONT></P>
<P STYLE="margin-left: 2cm"><IMG SRC="pictures/ZVDateControls02.PNG" NAME="grafika3" ALIGN=BOTTOM WIDTH=116 HEIGHT=35 BORDER=0></P>
<P STYLE="margin-left: 2cm"><BR><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>Checked: Boolean</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">If
ShowCheckBox is set to True, this property determines whether the
check box is checked or not. If ShowCheckBox is False, this property
has no purpose and is automatically set to True.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>DateDisplayOrder: TDateDisplayOrder</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>type</B>
TDateDisplayOrder = (ddoDMY, ddoMDY, ddoYMD, ddoTryDefault);</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">Defines
the order for displaying day, month and year part of the date. When
ddoTryDefault is set, then the controls tries to determine the order
from <A CLASS="western" HREF="http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/shortdateformat.html">ShortDateFormat
global variable</A>.</SPAN></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">This
is similar to <A CLASS="western" HREF="http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdateedit.dateorder.html">DateEdit's
DateOrder</A> property.</SPAN></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>DateSeparator: String</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Defines
the string used to separate date, month and year date parts. Setting
this property automatically sets the UseDefaultSeparators property to
False. To ensure that date and time separators are set to user's
system defaults, set UseDefaultSeparators property to True.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>TimeSeparator: String</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Defines
the string used to separate hour, minute, second and millisecond time
parts. Setting this property automatically sets the
UseDefaultSeparators property to False. To ensure that date and time
separators are set to user's system defaults, set
UseDefaultSeparators property to True.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>UseDefaultSeparators: Boolean</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">When
this property is set to True, then the DateSeparator and
TimeSeparator properties will be set to <A CLASS="western" HREF="http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/dateseparator.html">DateSeparator</A>
and <A CLASS="western" HREF="http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/timeseparator.html">TimeSeparator</A>
global variables, which are set to user system defaults when
application initializes.</SPAN></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>TrailingSeparator: Boolean</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">When
set to True, then the DateSeparator is shown once more, after the
last date part. This property exists because in some languages the
correct date format is <B>31. 1. 2010.</B> including the last point,
after the year.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>LeadingZeros: Boolean</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">Determines
whether the date and time parts are displayed with or without leading
zeros (this actually affects day, month and hour parts of date and
time display).</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>TimeDisplay: TTimeDisplay</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>type</B>
TTimeDisplay = (tdHM, tdHMS, tdHMSMs);</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">If
Kind is dtkTime or dtkDateTime, then TimeDisplay value of tdHM means
that only hours and minutes are displayed, tdHMS adds displaying of
seconds and value of tdHMSMs means that milliseconds are displayed
too.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>TimeFormat: TTimeFormat</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>type</B>
TTimeFormat = (tf12, tf24);</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">The
value of tf12 sets the display of time to 12 hours format, with AM/PM
string and tf24 sets to 24 hours format.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0cm"><A NAME="TextForNullDate"></A>
<FONT FACE="Arial, sans-serif"><B>TextForNullDate: String</B></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">Text
which appears when the null date is set and control does not have
focus. When control is focused, the text changes to defined format,
but displaying zeros for date, and nines for time (for example
&quot;00/00/0000 99:99:99&quot;), which is appropriate to user input.
User can set the date to NullDate by pressing N key, provided
<A CLASS="western" HREF="#NullInputAllowed">NullInputAllowed</A>
property is True.</SPAN></FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif">When
TextForNullDate is set to empty string, zeros/nines format is
displayed even when control does not have focus. If you want empty
display, this can be acchieved by setting TextForNullDate to one or
more space characters.</FONT></P>
<P STYLE="margin-left: 2cm; margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-top: 0.18cm; margin-bottom: 0cm"><A NAME="TDBZVDateTimePicker"></A>
<FONT FACE="Arial, sans-serif"><B>TDBZVDateTimePicker
<IMG SRC="pictures/TDBZVDateTimePicker.png" NAME="grafika6" ALIGN=MIDDLE WIDTH=24 HEIGHT=24 BORDER=0></B></FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif">TDBZVDateTimePicker is a data-aware
version of TZVDateTimePicker, with nice way of handling null database
values.</FONT></P>
<P STYLE="margin-top: 0.18cm; margin-bottom: 0cm"><BR>
</P>
<H4 CLASS="western" STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0.21cm">
<FONT FACE="Arial, sans-serif"><B>Displaying null values </B></FONT>
</H4>
<DL>
<DL>
<DD STYLE="margin-bottom: 0.5cm"><FONT FACE="Arial, sans-serif">When
the underlying DB field has null value, then:</FONT></DD></DL>
</DL>
<UL>
<UL>
<LI><DD STYLE="margin-bottom: 0.5cm">
<FONT FACE="Arial, sans-serif">When the control gets focus, the
text changes to defined format, but displaying zeros for date parts
and nines for time parts (for example &quot;00/00/0000 99:99:99&quot;),
which is appropriate to user input.</FONT></DD><LI><DD STYLE="margin-bottom: 0.5cm">
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">When the control
is not focused, then it displays the text defined in
<A CLASS="western" HREF="#TextForNullDate">TextForNullDate</A>
property. The default is &quot;NULL&quot;.</SPAN></FONT></DD></UL>
</UL>
<H4 CLASS="western" STYLE="margin-left: 1.48cm; margin-top: 0.18cm; margin-bottom: 0.21cm">
<FONT FACE="Arial, sans-serif">Setting the field value to null </FONT>
</H4>
<DL>
<DL>
<DD STYLE="margin-bottom: 0.5cm"><FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">If
<A CLASS="western" HREF="#NullInputAllowed">NullInputAllowed</A>
property is True, the user can set the date and time to null, by
pressing N key. </SPAN></FONT>
</DD></DL>
</DL>
<P STYLE="margin-top: 0.18cm; margin-bottom: 0cm">
<A NAME="ZVDateTimePicker Editor"></A><FONT FACE="Arial, sans-serif"><B>ZVDateTimePicker
Editor</B></FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<IMG SRC="pictures/ZVDateTimePickerEditor.PNG" NAME="grafika8" ALIGN=BOTTOM WIDTH=404 HEIGHT=188 BORDER=0></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif">ZVDateTimePicker Editor is a dialog
which provides easy way to set Date, Time, MinDate and MaxDate
properties in design time. It is invoked when ZVDateTimePicker
control is double-clicked in form designer. It is also shown when the
elipsis (…) button, shown in Date, Time, MinDate and MaxDate
properties in Object inspector, gets clicked.</FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<BR>
</P>
<P STYLE="margin-top: 0.18cm; margin-bottom: 0cm"><FONT FACE="Arial, sans-serif"><B>Tips</B></FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><B>Q:</B> When the date/time value is
null, how to display zeros/nines in user format, no matter whether
the control is focused or not?</FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US"><B>A:</B></SPAN></FONT>
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">Set <A CLASS="western" HREF="#TextForNullDate">TextForNullDate</A>
property to empty string. If TextForNullDate is set to empty string,
then zeros/nines are displayed, same as when the control has focus.</SPAN></FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<BR>
</P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US"><B>Q:</B></SPAN></FONT>
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">When the date/time
value is null, If empty string in <A CLASS="western" HREF="#TextForNullDate">TextForNullDate</A>
property actually sets the display to zeros/nines format, how to set
the control to display nothing?</SPAN></FONT></P>
<P STYLE="margin-left: 0.85cm; margin-top: 0.18cm; margin-bottom: 0cm">
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US"><B>A:</B></SPAN></FONT>
<FONT FACE="Arial, sans-serif"><SPAN LANG="en-US">Set <A CLASS="western" HREF="#TextForNullDate">TextForNullDate</A>
property to one space character, you will get the empty display.</SPAN></FONT></P>
</BODY>
</HTML>

View File

@ -0,0 +1,282 @@
{
TDBZVDateTimePicker control for Lazarus
- - - - - - - - - - - - - - - - - - - -
Author: Zoran Vučenović, January and February 2010
Зоран Вученовић, јануар и фебруар 2010.
Last change: August 2012
This unit is part of ZVDateTimeCtrls package for Lazarus.
TDBZVDateTimePicker is data-aware version of TZVDateTimePicker control.
-----------------------------------------------------------
LICENCE
- - - -
Modified LGPL -- see the file COPYING.modifiedLGPL.
-----------------------------------------------------------
NO WARRANTY
- - - - - -
There is no warranty whatsoever.
-----------------------------------------------------------
BEST REGARDS TO LAZARUS COMMUNITY!
- - - - - - - - - - - - - - - - - -
I do hope this control will be useful.
}
unit DBZVDateTimePicker;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, ZVDateTimePicker, db, DBCtrls;
type
{ TDBZVDateTimePicker }
TDBZVDateTimePicker = class(TCustomZVDateTimePicker)
private
{ Private declarations }
FDataLink: TFieldDataLink;
FReadOnly: Boolean;
FDataChangeCount: Integer;
FChangingCount: Integer;
function GetDataField: string;
function GetDataSource: TDataSource;
procedure SetDataField(const AValue: string);
procedure SetDataSource(const AValue: TDataSource);
procedure DataChange(Sender: TObject);
procedure SetReadOnly(const AValue: Boolean);
procedure UpdateData(Sender: TObject);
procedure ActiveChange(Sender: TObject);
function GetField: TField;
procedure CheckField;
protected
{ Protected declarations }
procedure Change; override;
procedure ConfirmChanges; override;
procedure UndoChanges; override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Field: TField read GetField;
published
{ Published declarations }
property DataField: string read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
property ReadOnly: Boolean read FReadOnly write SetReadOnly;
property ArrowShape;
property ShowCheckBox;
property Checked;
property CenturyFrom;
property DateDisplayOrder;
property MaxDate;
property MinDate;
property AutoSize;
property Font;
property ParentFont;
property TabOrder;
property TabStop;
property BorderStyle;
property BorderSpacing;
property Enabled;
property Color;
property ParentColor;
property DateSeparator;
property TrailingSeparator;
property TextForNullDate;
property LeadingZeros;
property ShowHint;
property ParentShowHint;
property Align;
property Anchors;
property Constraints;
property Cursor;
property PopupMenu;
property Visible;
property NullInputAllowed;
property Kind;
property TimeSeparator;
property TimeFormat;
property TimeDisplay;
{ property Time; This property should NOT be published here, it was
accidentally added in first release. }
property DateMode;
property UseDefaultSeparators;
//events:
property OnChange;
property OnCheckBoxChange;
property OnDropDown;
property OnCloseUp;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnEditingDone;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseMove;
property OnMouseUp;
property OnMouseLeave;
property OnResize;
property OnUTF8KeyPress;
end;
implementation
{ TDBZVDateTimePicker }
function TDBZVDateTimePicker.GetDataField: string;
begin
Result := FDataLink.FieldName;
end;
function TDBZVDateTimePicker.GetDataSource: TDataSource;
begin
Result := FDataLink.DataSource;
end;
procedure TDBZVDateTimePicker.SetDataField(const AValue: string);
begin
FDataLink.FieldName := AValue;
CheckField;
end;
procedure TDBZVDateTimePicker.SetDataSource(const AValue: TDataSource);
begin
ChangeDataSource(Self, FDataLink, AValue);
CheckField;
end;
procedure TDBZVDateTimePicker.DataChange(Sender: TObject);
begin
if (FChangingCount = 0) then begin
Inc(FDataChangeCount);
try
if Assigned(FDataLink.Field) and not FDataLink.Field.IsNull then begin
// Using the SetTheDateJumpMinMax procedure, instead of property
SetDateTimeJumpMinMax(FDataLink.Field.AsDateTime); // assignment allows
// this control to display dates from database whose value falls
// outside of MinDate and MaxDate interval.
// Note that user still cannot enter such values in the control.
end else
DateTime := NullDate;
finally
Dec(FDataChangeCount);
end;
end;
end;
procedure TDBZVDateTimePicker.SetReadOnly(const AValue: Boolean);
begin
if FReadOnly <> AValue then begin
FReadOnly := AValue;
CheckField;
end;
end;
procedure TDBZVDateTimePicker.UpdateData(Sender: TObject);
begin
if Assigned(FDataLink.Field) then begin
if DateIsNull then
FDataLink.Field.AsVariant := Null
else
FDataLink.Field.AsDateTime := DateTime;
end;
end;
procedure TDBZVDateTimePicker.ActiveChange(Sender: TObject);
begin
CheckField;
end;
function TDBZVDateTimePicker.GetField: TField;
begin
Result := FDataLink.Field;
end;
procedure TDBZVDateTimePicker.CheckField;
begin
if (FDataLink.Active) and Assigned(FDataLink.Field) then
inherited ReadOnly := FReadOnly or (not FDataLink.CanModify)
else begin
inherited ReadOnly := True;
DateTime := NullDate;
end;
end;
procedure TDBZVDateTimePicker.Change;
begin
if (FDataChangeCount <= 0) and Assigned(FDataLink) then begin
Inc(FChangingCount);
try
if FDataLink.Edit then begin
FDataLink.Modified;
inherited Change; // calls OnChange event handler
end else
FDataLink.Reset; // reverts user changes
finally
Dec(FChangingCount);
end;
end;
end;
procedure TDBZVDateTimePicker.ConfirmChanges;
begin
inherited ConfirmChanges;
if Assigned(FDataLink) then
try
FDataLink.UpdateRecord;
except
SetFocus;
raise;
end;
end;
procedure TDBZVDateTimePicker.UndoChanges;
begin
FDataLink.Reset;
inherited UndoChanges;
end;
constructor TDBZVDateTimePicker.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDataChangeCount := 0;
FChangingCount := 0;
FDataLink := TFieldDataLink.Create;
FDataLink.Control := Self;
DateTime := NullDate;
FDataLink.OnActiveChange := @ActiveChange;
FDataLink.OnDataChange := @DataChange;
FDataLink.OnUpdateData := @UpdateData;
CheckField;
end;
destructor TDBZVDateTimePicker.Destroy;
begin
FDataLink.OnUpdateData := nil;
FDataLink.OnDataChange := nil;
FDataLink.OnActiveChange := nil;
FreeAndNil(FDataLink);
inherited Destroy;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,49 @@
{
ZVDateTimeControlsReg
- - - - - - - - - - - - - - - - - -
Author: Zoran Vučenović, January and February 2010
Зоран Вученовић, јануар и фебруар 2010.
This unit is part of ZVDateTimeCtrls package for Lazarus.
-----------------------------------------------------------
LICENCE
- - - -
Modified LGPL -- see the file COPYING.modifiedLGPL.
-----------------------------------------------------------
NO WARRANTY
- - - - - -
There is no warranty whatsoever.
-----------------------------------------------------------
BEST REGARDS TO LAZARUS COMMUNITY!
- - - - - - - - - - - - - - - - - -
I do hope the ZVDateTimeCtrls package will be useful.
}
unit ZVDateTimeControlsReg;
{$mode objfpc}{$H+}
interface
procedure Register;
implementation
uses
Classes, ZVDateTimePicker, DBZVDateTimePicker, LResources;
procedure Register;
begin
RegisterComponents('Date and Time Ctrls', [
TZVDateTimePicker,
TDBZVDateTimePicker
]);
end;
initialization
{$i zvdatetimectrls.lrs}
end.

View File

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="ZVDateTimeCtrls"/>
<AddToProjectUsesSection Value="True"/>
<Author Value="Zoran Vučenović"/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="2"/>
</Optimizations>
</CodeGeneration>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Description Value="TZVDateTimePicker - the cross-platform control behaving much like VCL's TDateTimePicker. TDBZVDateTimePicker - the data-aware version of TZVDateTimePicker"/>
<License Value="Modified LGPL"/>
<Version Major="1" Minor="4"/>
<Files Count="5">
<Item1>
<Filename Value="zvdatetimepicker.pas"/>
<UnitName Value="ZVDateTimePicker"/>
</Item1>
<Item2>
<Filename Value="dbzvdatetimepicker.pas"/>
<UnitName Value="DBZVDateTimePicker"/>
</Item2>
<Item3>
<Filename Value="zvdatetimepickerpropedit.pas"/>
<UnitName Value="ZVDateTimePickerPropEdit"/>
</Item3>
<Item4>
<Filename Value="zvdatetimecontrolsreg.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="ZVDateTimeControlsReg"/>
</Item4>
<Item5>
<Filename Value="zvdatetimectrls.lrs"/>
<Type Value="LRS"/>
</Item5>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="IDEIntf"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
<CustomOptions Items="ExternHelp" Version="2">
<_ExternHelp Items="Count"/>
</CustomOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,33 @@
LazarusResources.Add('TZVDateTimePicker','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#7'tIME'#7#218#3#23#8'$'#25'n'#143#152#193#0#0#0#23'tEXtSoftware'#0'GLDP'
+'NG ver 3.4q'#133#164#225#0#0#0#8'tpNGGLD3'#0#0#0#0'J'#128')'#31#0#0#0#4'gAM'
+'A'#0#0#177#143#11#252'a'#5#0#0#0#206'IDATx'#156#221#148'1'#14#2'!'#16'E9'
+#150'g"'#246#155'P'#209#210'Zx'#6'.`'#236#12#198#214#27'Xli'#165'{'#132#209
+#193#176'!d 0B'#161#147#188#252'd'#19#230#207#31#194#10#241#23'5M;'#232#9'i'
+#176','#143'f'#210's'#238'|)'#27'h'#173'AJY'#165#177#129#16#218#19#12'P'#179
+#9#156's`'#173#173#210'pN)'#5#198#152':'#131#214#21'a'#179#152#172'A'#12'NTC'
+#238#146'I'#131'y'#190#193'f{bA%!'#13#184#144'SS'#6#251#195#157#165'M'#6'%'
+#222#29'V'#226#239#221#18'`'#227#143#194#200#4#224#25#146#160#219#29#228'v'
+#157'r'#188'>='#205#9'r'#187'N'#21#155'3'#19#0#185#235'tr'#150'A'#205#196'A'
+#155#31#218#208#151#252'-E'#3#172#244'g'#197#161'h'#240#179#245#2'2'#16#136
+#27#211'e'#18'f'#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('TDBZVDateTimePicker','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#7'tIME'#7#218#3#23#8'1'#25'Y:~'#213#0#0#0#23'tEXtSoftware'#0'GLDPNG ver'
+' 3.4q'#133#164#225#0#0#0#8'tpNGGLD3'#0#0#0#0'J'#128')'#31#0#0#0#4'gAMA'#0#0
+#177#143#11#252'a'#5#0#0#1'(IDATx'#156'c`'#160'''X~'#232#217#127#167#178'#X1'
+'H'#142'*'#6'_~'#248#249'?'#8#128#232#189#23#223#128#13#158#184#233'>e'#22
+#129'4'#22#204#190#6'6'#8'd('#186#225#213#139'o'#130#229'S&_'#2'[B'#178#5'0'
+#141'0'#23'b3'#28'&'#15'RK'#150#5' '#131#144#131#2#29'#'#251#130'd'#11'\+'
+#142#194'-'#0#185#30'['#28' '#251#132','#31#128','#1'i'#134'YP^>'#137'"L0'
+#136'@'#138#136#5' '#181#207#159'?'#134'c'#16#127#253#134#237#8'K'#176#5#17
+#204#2'CCc'#188#24#217#2'{{;'#236#22#224#10'"'#170#249#0'W'#16#193'pee'#227
+#255#170#170'*'#156#184#162#162#3'#'#14#136#10#162#251#247'o'#255#159#182#245
+'9Q4'#204'P'#24'F'#137'dPR'#196#22'D '#205#196'b'#12'Wc'#3#200'e'#18'!'#31#0
+'M'#2'ct'#31#16#157'7'#8#249#0#217#2#162'}'#128'n'#1'9q@'#150#15#208']Kv'#28
+#224#242#1#204#2#154#249#0#31#222'~'#230#29#24'S='#14'@'#134'"'#211'dY@*&'
+#201#2#16'x'#255#254'-'#195#186'u'#219#255#195'0rN'#197#133'I'#178#128#26#0#0
+#242#176#9'l'#161#206':'#16#0#0#0#0'IEND'#174'B`'#130
]);

View File

@ -0,0 +1,22 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit ZVDateTimeCtrls;
interface
uses
ZVDateTimePicker, DBZVDateTimePicker, ZVDateTimePickerPropEdit,
ZVDateTimeControlsReg, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('ZVDateTimeControlsReg', @ZVDateTimeControlsReg.Register);
end;
initialization
RegisterPackage('ZVDateTimeCtrls', @Register);
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,495 @@
{
ZVDateTimePickerPropEdit
- - - - - - - - - - - - - - - - -
Author: Zoran Vučenović, January and February 2010
Зоран Вученовић, јануар и фебруар 2010.
Last change: August 2012.
This unit is part of ZVDateTimeCtrls package for Lazarus. It contains
component and property editors for TZVDateTimePicker control.
-----------------------------------------------------------
LICENCE
- - - -
Modified LGPL -- see the file COPYING.modifiedLGPL.
-----------------------------------------------------------
NO WARRANTY
- - - - - -
There is no warranty whatsoever.
-----------------------------------------------------------
BEST REGARDS TO LAZARUS COMMUNITY!
- - - - - - - - - - - - - - - - - -
I do hope the ZVDateTimeCtrls package will be useful.
}
unit ZVDateTimePickerPropEdit;
{$mode objfpc}{$H+}
interface
// Nothing needs to be in interface section!
implementation
uses
Classes, SysUtils, Forms, Controls, ButtonPanel, ZVDateTimePicker,
DBZVDateTimePicker, StdCtrls, Math, Menus, ComponentEditors, PropEdits;
type
{ TFormZVDateTimePickerEditor }
TFormZVDateTimePickerEditor = class(TForm)
private
CallerZVDateTimePicker: TZVDateTimePicker;
Prop: String;
Modified: Boolean;
ButtonPanel: TButtonPanel;
ZVDateTimePickerMin: TZVDateTimePicker;
ZVDateTimePicker1: TZVDateTimePicker;
ZVDateTimePickerMax: TZVDateTimePicker;
Label1: TLabel;
LabelMin: TLabel;
LabelMax: TLabel;
LabelNull: TLabel;
procedure ZVDateTimePickerMaxExit(Sender: TObject);
procedure ZVDateTimePickerMinExit(Sender: TObject);
procedure ZVDateTimePickersChange(Sender: TObject);
procedure ZVDateTimePicker1Enter(Sender: TObject);
procedure ZVDateTimePicker1Exit(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Initialize(const Caller: TZVDateTimePicker;
const PropertyName, PropertyType: String);
procedure UpdateMinMaxBounds;
public
constructor CreateNew(AOwner: TComponent; Num: Integer = 0); override;
destructor Destroy; override;
end;
{ TZVDateTimePickerComponentEditor }
TZVDateTimePickerComponentEditor = class(TComponentEditor)
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
{ TZVDateTimePickerDateTimePropEditor }
TZVDateTimePickerDateTimePropEditor = class(TDateTimePropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
function AllEqual: Boolean; override;
function GetValue: string; override;
procedure SetValue(const Value: string); override;
procedure Edit; override;
end;
{ TSimpleDatePropEditor }
TSimpleDatePropEditor = class(TDatePropertyEditor)
public
function GetValue: string; override;
procedure SetValue(const Value: string); override;
end;
procedure RegPropEdits;
begin
RegisterPropertyEditor(TypeInfo(TTime), TZVDateTimePicker, 'Time', TZVDateTimePickerDateTimePropEditor);
RegisterPropertyEditor(TypeInfo(TDate), TZVDateTimePicker, 'Date', TZVDateTimePickerDateTimePropEditor);
RegisterPropertyEditor(TypeInfo(TDate), TZVDateTimePicker, 'MaxDate', TZVDateTimePickerDateTimePropEditor);
RegisterPropertyEditor(TypeInfo(TDate), TZVDateTimePicker, 'MinDate', TZVDateTimePickerDateTimePropEditor);
RegisterPropertyEditor(TypeInfo(TDate), TDBZVDateTimePicker, 'MaxDate', TSimpleDatePropEditor);
RegisterPropertyEditor(TypeInfo(TDate), TDBZVDateTimePicker, 'MinDate', TSimpleDatePropEditor);
end;
{ TZVDateTimePickerComponentEditor }
procedure TZVDateTimePickerComponentEditor.ExecuteVerb(Index: Integer);
var
F: TFormZVDateTimePickerEditor;
DTPicker: TZVDateTimePicker;
begin
if Index = 0 then begin
if GetComponent is TZVDateTimePicker then begin
F := TFormZVDateTimePickerEditor.CreateNew(nil, 0);
try
DTPicker := TZVDateTimePicker(GetComponent);
if DTPicker.Kind = dtkTime then
F.Initialize(DTPicker, '', 'TTime')
else
F.Initialize(DTPicker, '', '');
if F.ShowModal = mrOK then begin
if F.Modified then begin
DTPicker.MinDate := TheSmallestDate;
DTPicker.MaxDate := F.ZVDateTimePickerMax.DateTime;
DTPicker.MinDate := F.ZVDateTimePickerMin.DateTime;
DTPicker.DateTime := F.ZVDateTimePicker1.DateTime;
Modified;
GlobalDesignHook.RefreshPropertyValues;
end;
end;
finally
F.Free;
end;
end else
raise Exception.Create('Unknown ZVDateTimePicker object to edit.');
end;
end;
function TZVDateTimePickerComponentEditor.GetVerb(Index: Integer): string;
begin
if Index = 0 then
Result := '&Date/Time Editor...';
end;
function TZVDateTimePickerComponentEditor.GetVerbCount: Integer;
begin
Result := 1;
end;
{ TFormZVDateTimePickerEditor }
procedure TFormZVDateTimePickerEditor.ZVDateTimePickerMaxExit(Sender: TObject);
begin
if ZVDateTimePickerMin.Date > ZVDateTimePickerMax.Date then
ZVDateTimePickerMin.Date := ZVDateTimePickerMax.Date;
UpdateMinMaxBounds;
end;
procedure TFormZVDateTimePickerEditor.ZVDateTimePickerMinExit(Sender: TObject);
begin
if ZVDateTimePickerMax.Date < ZVDateTimePickerMin.Date then
ZVDateTimePickerMax.Date := ZVDateTimePickerMin.Date;
UpdateMinMaxBounds;
end;
procedure TFormZVDateTimePickerEditor.ZVDateTimePickersChange(Sender: TObject);
begin
Modified := True;
end;
procedure TFormZVDateTimePickerEditor.ZVDateTimePicker1Enter(Sender: TObject);
begin
if ZVDateTimePicker1.NullInputAllowed then
LabelNull.Show;
end;
procedure TFormZVDateTimePickerEditor.ZVDateTimePicker1Exit(Sender: TObject);
begin
LabelNull.Hide;
end;
procedure TFormZVDateTimePickerEditor.FormActivate(Sender: TObject);
var
B: Boolean;
begin
OnActivate := nil;
B := False;
if Prop = 'MAXDATE' then ZVDateTimePickerMax.SetFocus
else if Prop = 'MINDATE' then ZVDateTimePickerMin.SetFocus
else begin
ZVDateTimePicker1.SetFocus;
B := ZVDateTimePicker1.NullInputAllowed;
end;
LabelNull.Visible := B;
LabelNull.BringToFront;
end;
procedure TFormZVDateTimePickerEditor.Initialize(const Caller: TZVDateTimePicker;
const PropertyName, PropertyType: String);
var
I: Integer;
DTP: array[1..3] of TZVDateTimePicker;
L, T, W, H: Integer;
R: TRect;
begin
if Assigned(Caller) then begin
CallerZVDateTimePicker := Caller;
Prop := UpperCase(PropertyName);
Modified := False;
ZVDateTimePicker1.Kind := dtkDateTime;
if UpperCase(PropertyType) = 'TTIME' then
ZVDateTimePicker1.SelectTime
else
ZVDateTimePicker1.SelectDate;
Label1.Caption := 'Date / Time:';
LabelMax.Caption := 'MaxDate:';
LabelMin.Caption := 'MinDate:';
LabelNull.Caption := '(Press N to set to NULL)';
ZVDateTimePickerMin.DateTime := CallerZVDateTimePicker.MinDate;
ZVDateTimePickerMax.DateTime := CallerZVDateTimePicker.MaxDate;
ZVDateTimePicker1.MinDate := CallerZVDateTimePicker.MinDate;
ZVDateTimePicker1.MaxDate := CallerZVDateTimePicker.MaxDate;
ZVDateTimePicker1.DateTime := CallerZVDateTimePicker.DateTime;
DTP[1] := ZVDateTimePickerMin;
DTP[2] := ZVDateTimePickerMax;
DTP[3] := ZVDateTimePicker1;
for I := 1 to 3 do begin
DTP[I].NullInputAllowed := I = 3;
DTP[I].CenturyFrom := CallerZVDateTimePicker.CenturyFrom;
DTP[I].DateDisplayOrder := CallerZVDateTimePicker.DateDisplayOrder;
DTP[I].LeadingZeros := CallerZVDateTimePicker.LeadingZeros;
DTP[I].DateSeparator := CallerZVDateTimePicker.DateSeparator;
DTP[I].TrailingSeparator := CallerZVDateTimePicker.TrailingSeparator;
end;
ZVDateTimePicker1.TextForNullDate := CallerZVDateTimePicker.TextForNullDate;
ZVDateTimePicker1.TimeSeparator := CallerZVDateTimePicker.TimeSeparator;
ZVDateTimePicker1.TimeDisplay := tdHMSMs;
ZVDateTimePicker1.TimeFormat := CallerZVDateTimePicker.TimeFormat;
ZVDateTimePickerMax.AnchorParallel(akTop, 20, Self);
ZVDateTimePickerMax.AnchorParallel(akRight, 20, Self);
LabelMax.AnchorVerticalCenterTo(ZVDateTimePickerMax);
LabelMax.AnchorToNeighbour(akRight, 2, ZVDateTimePickerMax);
ZVDateTimePickerMin.AnchorParallel(akTop, 20, Self);
ZVDateTimePickerMin.AnchorToNeighbour(akRight, 20, LabelMax);
LabelMin.AnchorToNeighbour(akRight, 2, ZVDateTimePickerMin);
LabelMin.AnchorVerticalCenterTo(ZVDateTimePickerMin);
ZVDateTimePicker1.AnchorParallel(akLeft, 0, ZVDateTimePickerMin);
ZVDateTimePicker1.AnchorToNeighbour(akTop, 20, ZVDateTimePickerMin);
Label1.AnchorToNeighbour(akRight, 2, ZVDateTimePicker1);
Label1.AnchorVerticalCenterTo(ZVDateTimePicker1);
LabelNull.AnchorToNeighbour(akTop, 2, ZVDateTimePicker1);
LabelNull.AnchorHorizontalCenterTo(ZVDateTimePicker1);
ButtonPanel.Spacing := 10;
ButtonPanel.BorderSpacing.Around := 10;
W := Max(Label1.Width, LabelMin.Width);
W := ZVDateTimePickerMax.Width + ZVDateTimePickerMin.Width
+ LabelMax.Width + W + 80;
H := 2 * ZVDateTimePickerMax.Height + LabelNull.Height + ButtonPanel.Height + 58;
R := Screen.MonitorFromWindow(CallerZVDateTimePicker.Handle).WorkareaRect;
L := (R.Left + R.Right - W) div 2;
T := (R.Top + R.Bottom - H) div 2;
if L < R.Left then L := R.Left;
if T < R.Top then T := R.Top;
SetBounds(L, T, W, H);
end;
end;
procedure TFormZVDateTimePickerEditor.UpdateMinMaxBounds;
begin
ZVDateTimePicker1.MinDate := TheSmallestDate;
ZVDateTimePicker1.MaxDate := ZVDateTimePickerMax.Date;
ZVDateTimePicker1.MinDate := ZVDateTimePickerMin.Date;
end;
constructor TFormZVDateTimePickerEditor.CreateNew(AOwner: TComponent;
Num: Integer);
var
I: Integer;
begin
inherited CreateNew(AOwner, Num);
Hide;
if Font.Size > 10 then
Font.Size := 10;
SetBounds(-8000, -8000, 4, 5);
BorderStyle := bsDialog;
BorderIcons := [biSystemMenu];
Caption := 'ZVDateTimePicker Editor';
ZVDateTimePickerMax := TZVDateTimePicker.Create(Self);
ZVDateTimePickerMin := TZVDateTimePicker.Create(Self);
ZVDateTimePicker1 := TZVDateTimePicker.Create(Self);
Label1 := TLabel.Create(Self);
LabelMin := TLabel.Create(Self);
LabelMax := TLabel.Create(Self);
LabelNull := TLabel.Create(Self);
ButtonPanel := TButtonPanel.Create(Self);
ButtonPanel.ShowButtons := [pbOK, pbCancel];
ButtonPanel.OKButton.GlyphShowMode := gsmAlways;
ButtonPanel.CancelButton.GlyphShowMode := gsmAlways;
ButtonPanel.ShowBevel := False;
ZVDateTimePickerMax.Parent := Self;
ZVDateTimePickerMin.Parent := Self;
ZVDateTimePicker1.Parent := Self;
Label1.Parent := Self;
LabelMin.Parent := Self;
LabelMax.Parent := Self;
LabelNull.Parent := Self;
ButtonPanel.Parent := Self;
ButtonPanel.TabOrder := 0;
ZVDateTimePickerMin.TabOrder := 1;
ZVDateTimePickerMax.TabOrder := 2;
ZVDateTimePicker1.TabOrder := 3;
for I := 0 to ControlCount - 1 do begin
Controls[I].Anchors := [];
Controls[I].AutoSize := True;
end;
ZVDateTimePickerMax.OnExit := @ZVDateTimePickerMaxExit;
ZVDateTimePickerMin.OnExit := @ZVDateTimePickerMinExit;
ZVDateTimePicker1.OnExit := @ZVDateTimePicker1Exit;
ZVDateTimePicker1.OnEnter := @ZVDateTimePicker1Enter;
ZVDateTimePickerMin.OnChange := @ZVDateTimePickersChange;
ZVDateTimePickerMax.OnChange := @ZVDateTimePickersChange;
ZVDateTimePicker1.OnChange := @ZVDateTimePickersChange;
OnActivate := @FormActivate;
end;
destructor TFormZVDateTimePickerEditor.Destroy;
begin
OnActivate := nil;
OnShow := nil;
ZVDateTimePicker1.OnChange := nil;
ZVDateTimePickerMax.OnChange := nil;
ZVDateTimePickerMin.OnChange := nil;
ZVDateTimePicker1.OnEnter := nil;
ZVDateTimePicker1.OnExit := nil;
ZVDateTimePickerMin.OnExit := nil;
ZVDateTimePickerMax.OnExit := nil;
ButtonPanel.Free;
LabelNull.Free;
LabelMax.Free;
LabelMin.Free;
Label1.Free;
ZVDateTimePicker1.Free;
ZVDateTimePickerMin.Free;
ZVDateTimePickerMax.Free;
inherited Destroy;
end;
{ TZVDateTimePickerDateTimePropEditor }
function TZVDateTimePickerDateTimePropEditor.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [paDialog];
end;
function TZVDateTimePickerDateTimePropEditor.AllEqual: Boolean;
var
DT: TDateTime;
N: Integer;
begin
Result := True;
N := PropCount;
if N > 1 then begin
DT := TDateTime(GetFloatValue);
repeat
Dec(N);
Result := EqualDateTime(DT, TDateTime(GetFloatValueAt(N)));
until not(Result and (N > 1));
end;
end;
function TZVDateTimePickerDateTimePropEditor.GetValue: string;
var
DT: TDateTime;
S: String;
begin
DT := TDateTime(GetFloatValue);
if IsNullDate(DT) then
Result := 'NULL'
else begin
S := UpperCase(GetPropType^.Name);
if S = 'TDATE' then
Result := DateToStr(DT)
else if S = 'TTIME' then
Result := TimeToStr(DT)
else
Result := DateTimeToStr(DT);
end;
end;
procedure TZVDateTimePickerDateTimePropEditor.SetValue(const Value: string);
var
S: String;
begin
S := Trim(Value);
if (S > '') and (UpCase(S[1]) <> 'N') then begin
S := UpperCase(GetPropType^.Name);
if S = 'TDATE' then
SetFloatValue(StrToDate(Value))
else if S = 'TTIME' then
SetFloatValue(StrToTime(Value))
else
inherited SetValue(Value);
end else
SetFloatValue(NullDate);
end;
procedure TZVDateTimePickerDateTimePropEditor.Edit;
var
F: TFormZVDateTimePickerEditor;
I: Integer;
DT: TZVDateTimePicker;
begin
for I := 0 to PropCount - 1 do
if not (GetComponent(I) is TZVDateTimePicker) then
Exit;
F := TFormZVDateTimePickerEditor.CreateNew(nil, 0);
try
F.Initialize(TZVDateTimePicker(GetComponent(0)), GetName, GetPropType^.Name);
if F.ShowModal = mrOK then begin
if F.Modified then begin
for I := 0 to PropCount - 1 do begin
DT := TZVDateTimePicker(GetComponent(I));
DT.MinDate := TheSmallestDate;
DT.MaxDate := F.ZVDateTimePickerMax.Date;
DT.MinDate := F.ZVDateTimePickerMin.Date;
DT.DateTime := F.ZVDateTimePicker1.DateTime;
end;
Modified;
GlobalDesignHook.RefreshPropertyValues;
end;
end;
finally
F.Free;
end;
end;
{ TSimpleDatePropEditor }
function TSimpleDatePropEditor.GetValue: string;
begin
Result := DateToStr(GetFloatValue);
end;
procedure TSimpleDatePropEditor.SetValue(const Value: string);
var
S: String;
begin
S := Trim(Value);
if (S > '') and (UpCase(S[1]) <> 'N') then
inherited SetValue(S);
end;
initialization
RegPropEdits;
RegisterComponentEditor(TZVDateTimePicker, TZVDateTimePickerComponentEditor);
end.