tinycobol/tcltk84/tk8.4/mentry2.8/doc/mentryDateTime.html

325 lines
11 KiB
HTML

<html>
<head>
<title>Multi-Entry Widgets for Date and Time</title>
<meta name="Author" content="Csaba Nemethi">
<meta name="Keywords" content="mentry, widget, date, time, clock">
</head>
<body bgcolor=#ffffff>
<div align=center>
<h1>Multi-Entry Widgets for Date and Time</h1>
<h3>by</h3>
<h2>Csaba Nemethi</h2>
<address>
<a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
</address>
</div>
<p><hr>
<a name="contents"></a>
<h2>Contents</h2>
<ul>
<li><a href="#dateMentry">The <code><b>mentry::dateMentry</b></code>
Command</a>
<li><a href="#timeMentry">The <code><b>mentry::timeMentry</b></code>
Command</a>
<li><a href="#putClockVal">The <code><b>mentry::putClockVal</b></code>
Command</a>
<li><a href="#getClockVal">The <code><b>mentry::getClockVal</b></code>
Command</a>
</ul>
<div align=center>
<p><a href="index.html">Start page</a>
</div>
<p><hr>
<a name="dateMentry"></a>
<h2>The <code><b><font size=5>mentry::dateMentry</font></b></code> Command</h2>
<dl>
<dt><b>NAME</b>
<dd><code>mentry::dateMentry</code> - Create and manipulate mentry widgets
for date
<p>
<dt><b>SYNOPSIS</b>
<dd>
<pre>
<b>mentry::dateMentry</b> <i>pathName format separator</i> ?<i>options</i>?
</pre>
<p>
<dt><b>DESCRIPTION</b>
<dd>This command creates a new mentry widget <code><i>pathName</i></code>
for displaying and editing a date according to the
<code><i>format</i></code> argument, which must be a string of length
3, consisting of the letters <code><b>"d"</b></code> for the day
(<code>01</code> - <code>31</code>), <code><b>"m"</b></code> for the
month (<code>01</code> - <code>12</code>), and <code><b>"y"</b></code>
or <code><b>"Y"</b></code> for the year without century
(<code>00</code> - <code>99</code>) or with century (e.g.,
<code>2003</code>), in an arbitrary order.&nbsp; These field descriptor
characters have the same meanings as in the&nbsp; <code><b>clock
format</b></code>&nbsp; command.&nbsp; The
<code><i>separator</i></code> argument specifies the text to be
displayed in the labels separating the three entry children of the
mentry widget (the most common values are the <code><b>"/"</b></code>,
<code><b>"-"</b></code>, and <code><b>"."</b></code> characters).&nbsp;
The supported <code><i>options</i></code> are the same as in the case
of the <code><b><a href=
"mentryWidget.html">mentry::mentry</a></b></code> command.
<p>
<dd>The command sets the <code><b>type</b></code> attribute of the widget
to the value <code>"Date"</code>, saves the value of
<code><i>format</i></code> in its <code><b>format</b></code> attribute,
and returns the name of the newly created widget.
<p>
<dt><b>DEFAULT BINDINGS</b>
<dd>The <code><b>mentry::dateMentry</b></code> command defines four new
bindings for the entry children of the mentry widget it creates:&nbsp;
The <code>Up</code> key increments the entry's value by 1 if the latter
is less than the allowed maximum for that child.&nbsp; Similarly, the
<code>Down</code> key decrements the entry's value by 1 if the latter
is greater than the allowed minimum for that child.&nbsp; The
<code>Prior</code> key increments the entry's value by at most 10 if
the latter is less than the allowed maximum for that child.&nbsp;
Similarly, the <code>Next</code> key decrements the entry's value by at
most 10 if the latter is greater than the allowed minimum for that
child.&nbsp; If the entry is empty then all of these keys insert the
child-specific minimum value into the entry.
<p>
<dt><b>KEYWORDS</b>
<dd>mentry, widget, date
</dl>
<div align=center>
<p><a href="#contents">Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="index.html">Start page</a>
</div>
<p><hr>
<a name="timeMentry"></a>
<h2>The <code><b><font size=5>mentry::timeMentry</font></b></code> Command</h2>
<dl>
<dt><b>NAME</b>
<dd><code>mentry::timeMentry</code> - Create and manipulate mentry widgets
for time
<p>
<dt><b>SYNOPSIS</b>
<dd>
<pre>
<b>mentry::timeMentry</b> <i>pathName format separator</i> ?<i>options</i>?
</pre>
<p>
<dt><b>DESCRIPTION</b>
<dd>This command creates a new mentry widget <code><i>pathName</i></code>
for displaying and editing a time according to the
<code><i>format</i></code> argument, which must be a string of length
2 or 3, consisting of the following field descriptor characters of
the&nbsp; <code><b>clock format</b></code>&nbsp; command:
<code><b>"H"</b></code> or <code><b>"I"</b></code>, followed by
<code><b>"M"</b></code>, and optionally the letter
<code><b>"S"</b></code>.&nbsp; An <code><b>"H"</b></code> as first
character specifies the time format <code><b>"%H:%M"</b></code> or
<code><b>"%H:%M:%S"</b></code> (i.e., with the hour between
<code>0</code> and <code>23</code>), while the letter
<code><b>"I"</b></code> stands for&nbsp; <code><b>"%I:%M
%p"</b></code>&nbsp; or&nbsp; <code><b>"%I:%M:%S %p"</b></code>&nbsp;
(i.e., with AM/PM indicator).&nbsp; The <code><i>separator</i></code>
argument specifies the text to be displayed in the labels separating
the entry children of the mentry widget.&nbsp; (this is usually the
<code><b>":"</b></code> character).&nbsp; The
<code><i>options</i></code> are the same as in the case of the
<code><b><a href="mentryWidget.html">mentry::mentry</a></b></code>
command.
<p>
<dd>The command sets the <code><b>type</b></code> attribute of the widget
to the value <code>"Time"</code>, saves the value of
<code><i>format</i></code> in its <code><b>format</b></code> attribute,
and returns the name of the newly created widget.
<p>
<dt><b>DEFAULT BINDINGS</b>
<dd>The <code><b>mentry::timeMentry</b></code> command defines four new
bindings for the entry children of the mentry widget it creates:&nbsp;
The <code>Up</code> key increments the entry's value by 1 if the latter
is less than the allowed maximum for that child.&nbsp; Similarly, the
<code>Down</code> key decrements the entry's value by 1 if the latter
is greater than the allowed minimum for that child.&nbsp; The
<code>Prior</code> key increments the entry's value by at most 10 if
the latter is less than the allowed maximum for that child.&nbsp;
Similarly, the <code>Next</code> key decrements the entry's value by at
most 10 if the latter is greater than the allowed minimum for that
child.&nbsp; If the entry is empty then all of these keys insert the
child-specific minimum value into the entry.
<p>
<dt><b>KEYWORDS</b>
<dd>mentry, widget, time
</dl>
<div align=center>
<p><a href="#contents">Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="index.html">Start page</a>
</div>
<p><hr>
<a name="putClockVal"></a>
<h2>The <code><b><font size=5>mentry::putClockVal</font></b></code> Command</h2>
<dl>
<dt><b>NAME</b>
<dd><code>mentry::putClockVal</code> - Output a clock value to a date or
time mentry
<p>
<dt><b>SYNOPSIS</b>
<dd>
<pre>
<b>mentry::putClockVal</b> <i>clockValue</i> <i>pathName</i> ?<b>-gmt</b> <i>boolean</i>?
</pre>
<p>
<dt><b>DESCRIPTION</b>
<dd>This command outputs the date or time corresponding to the integer
<code><i>clockValue</i></code> to the mentry widget
<code><i>pathName</i></code>, which must have been created with the
<code><b><a href="#dateMentry">mentry::dateMentry</a></b></code> or
<code><b><a href="#timeMentry">mentry::timeMentry</a></b></code>
command (this is checked by examining the widget's
<code><b>type</b></code> attribute, which must have the value
<code>"Date"</code> or <code>"Time"</code>).
<p>
<dd>Like in the case of the&nbsp; <code><b>clock format</b></code>&nbsp;
command, the optional argument pair&nbsp; <code><b>-gmt</b>
<i>boolean</i></code> specifies whether the clock value is to be
formatted as Greenwich Mean Time or according to the local timezone as
defined by the operating environment.
<p>
<dt><b>KEYWORDS</b>
<dd>mentry, widget, date, time, clock
</dl>
<div align=center>
<p><a href="#contents">Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="index.html">Start page</a>
</div>
<p><hr>
<a name="getClockVal"></a>
<h2>The <code><b><font size=5>mentry::getClockVal</font></b></code> Command</h2>
<dl>
<dt><b>NAME</b>
<dd><code>mentry::getClockVal</code> - Get the clock value from a date or
time mentry
<p>
<dt><b>SYNOPSIS</b>
<dd>
<pre>
<b>mentry::getClockVal</b> <i>pathName</i> ?<b>-base</b> <i>clockValue</i>? ?<b>-gmt</b> <i>boolean</i>?
</pre>
<p>
<dt><b>DESCRIPTION</b>
<dd>This command returns the clock value corresponding to the date or time
contained in the mentry widget <code><i>pathName</i></code>, which must
have been created with the <code><b><a href=
"#dateMentry">mentry::dateMentry</a></b></code> or <code><b><a href=
"#timeMentry">mentry::timeMentry</a></b></code> command (this is
checked by examining the widget's <code><b>type</b></code> attribute,
which must have the value <code>"Date"</code> or <code>"Time"</code>).
<p>
<dd>Like in the case of the&nbsp; <code><b>clock scan</b></code>&nbsp;
command, the optional argument pair&nbsp; <code><b>-base</b>
<i>clockValue</i></code> specifies that the date contained in
<code><i>clockValue</i></code> is to be used when getting the clock
value from the given mentry widget, and the optional argument
pair&nbsp; <code><b>-gmt</b> <i>boolean</i></code> specifies whether
the clock value is to be calculated relative to Greenwich Mean Time or
according to the local timezone as defined by the operating
environment.
<p>
<dd>If an error occurs during the conversion, the command sets the focus to
the first erronous entry child, generates an error, and returns one of
the values contained in the following table:
<p>
<table border=2 cellspacing=0 cellpadding=4>
<tr bgcolor=#ffffe0>
<th align=left>Return value</th>
<th align=left>Meaning</th>
</tr>
<tr>
<td><code>"EMPTY"</code></td>
<td>Any entry child (except the one containing the seconds) is
empty.</td>
</tr>
<tr>
<td><code>"BAD"</code></td>
<td>The value of the day, month, or hour (the latter only if the
AM/PM indicator is present) is <code>0</code>.</td>
</tr>
<tr>
<td><code>"BAD_DATE"</code></td>
<td>The &lt;year, month, day&gt; triple is invalid (note that the
command is aware of leap years).</td>
</tr>
<tr>
<td><code>"BAD_YEAR"</code></td>
<td>The above triple is valid, but the conversion (made with the
aid of the&nbsp; <code><b>clock scan</b></code>&nbsp; command)
failed because of an unsupported year value (e.g., between
<code>38</code> and <code>70</code>).</td>
</tr>
</table>
<p>
<dt><b>KEYWORDS</b>
<dd>mentry, widget, date, time, clock
</dl>
<div align=center>
<p><a href="#contents">Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="index.html">Start page</a>
</div>
</body>
</html>