[r8770]: ooDialog / branches / 4.2.1 / doc / oodialog / en-US / datetimepicker.xml  Maximize  Restore  History

Download this file

1894 lines (1720 with data), 69.6 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "oodialog.ent">
%BOOK_ENTITIES;
]>
<!--#########################################################################
#
# Description: Open Object Rexx: ooDialog Reference XML file.
#
# Copyright (c) 2005-2013 Rexx Language Association. All rights reserved.
# Portions Copyright (c) 2004, IBM Corporation. All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Common Public License v1.0 which accompanies this
# distribution. A copy is also available at the following address:
# http://www.oorexx.org/license.html
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the distribution.
#
# Neither the name of Rexx Language Association nor the names
# of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#########################################################################
-->
<chapter id="clsDateTimePicker" xreflabel="DateTimePicker"><title>Date Time Picker Controls</title>
<indexterm><primary>DateTimePicker class</primary></indexterm>
<para>
A date and time picker (DTP) control provides a simple interface with which to exchange date and time information
with a user. For example, with a DTP control you can ask the user to enter a date and then easily retrieve the
selection.
</para>
<note><title>Note</title><para>
Windows does not support dates prior to 1601. Trying to set a date prior to 1601, programmatically, will raise a
syntax condition.
</para>
<para>
The control is based on the Gregorian calendar, which was introduced in 1753. The date and time picker control will
not calculate dates that are consistent with the Julian calendar.
</para></note>
<para>
The client area of a date and time picker (DTP) control displays date or time information, or both, and acts as the
interface through which users modify the information. The date can be selected from a calendar, or by using an up-down
control. The time can be changed by typing in fields that are defined by the control's Format <link
linkend="sctDTPFormatStrings">Strings</link>. The control can optionally display a check box. When it
is checked, the value in the control is considered valid and can be retrieved. When not checked, the control's date
and time is not valid.
</para>
<para>
The <computeroutput>DateTimePicker</computeroutput> class provides methods to get and set the date and time in the
underlying DTP control, along with methods to manipulate the control. It is a concrete subclass of the dialog <xref
linkend="chpDialogControlObject" /> object and therefore has all methods of the of the dialog control object.
</para>
<para>
In addition to the methods of the class itself, the following methods from other classes in the ooDialog framework are
needed, or are useful, when working with DTP controls:
<variablelist>
<varlistentry><term><emphasis role="bold">Instantiation:</emphasis></term>
<listitem>
<para>
Use the <xref linkend="mthNewDateTimePicker"/> method of the <xref linkend="chpDialogObject" /> to retrieve a date and
time picker object.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Dynamic Definition:</emphasis></term>
<listitem>
<para>
To dynamically add a date and time picker to a <xref linkend="clsUserDialog"/> use the
<xref linkend="mthCreateDateTimePicker"/> method.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Event Notification</emphasis></term>
<listitem>
<para>
To receive notification of date and time picker events use the <xref linkend="mthConnectDateTimePickerEvent"/> method.
</para>
</listitem></varlistentry>
</variablelist>
</para>
<section id="sctDTPFormatStrings"><title>Format Strings</title>
<para>
Date and time picker controls rely on a <emphasis role="italic">format</emphasis> string to display the date and time.
The format string defines how the date and time is displayed. There are 4 preset format strings that are assigned with
4 of the date and time styles. If the preset format strings are not adequate, the programmer can define his own format
string and assign it to the date and time picker through the <xref linkend="mthSetFormat"/> method.
</para>
<para>
The 4 preset format strings and their associated styles are in the following table:
<table id="tblDTPPresetFormats" frame="all"> <title>DTP Preset Formats</title>
<tgroup cols="2">
<colspec colwidth="1*" /><colspec colwidth="5*" />
<thead>
<row>
<entry>Style</entry>
<entry>Format</entry>
</row>
</thead>
<tbody>
<row>
<entry>LONG</entry>
<entry>The format displays like: Wednesday, June 22, 2011.</entry>
</row>
<row>
<entry>SHORT</entry>
<entry>The format displays like: 6/22/11.</entry>
</row>
<row>
<entry>CENTURY</entry>
<entry>The format displays like: 6/22/2011.</entry>
</row>
<row>
<entry>TIME</entry>
<entry>The format displays like: 5:31:42 PM.</entry>
</row>
</tbody></tgroup>
</table>
</para>
<para>
DTP format strings consist of a series of elements that represent a particular piece of information and define its
display format. The elements are displayed in the order they appear in the format string. Custom formats give the
programmer greater flexibility within a program. They allow the programmer to specify the order in which the control
will display fields of information. The format string can include body text as well as callback fields for requesting
information from the user.
</para>
<para>
Date and time format elements are replaced by the actual date and time. The following table shows the date and time
elements and a description of what they produce:
<table id="tblDTPPFormatElementss" frame="all"> <title>DTP Format Elements</title>
<tgroup cols="2">
<colspec colwidth="1*" /><colspec colwidth="5*" />
<thead>
<row>
<entry>Element</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>d</entry>
<entry>The one- or two-digit day</entry>
</row>
<row>
<entry>dd</entry>
<entry>The two-digit day. Single-digit day values are preceded by a zero.</entry>
</row>
<row>
<entry>ddd</entry>
<entry>The three-character weekday abbreviation.</entry>
</row>
<row>
<entry>dddd</entry>
<entry>The full weekday name.</entry>
</row>
<row>
<entry>h</entry>
<entry>The one- or two-digit hour in 12-hour format.</entry>
</row>
<row>
<entry>hh</entry>
<entry>The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.</entry>
</row>
<row>
<entry>H</entry>
<entry>The one- or two-digit hour in 24-hour format.</entry>
</row>
<row>
<entry>HH</entry>
<entry>The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.</entry>
</row>
<row>
<entry>m</entry>
<entry>The one- or two-digit minute. </entry>
</row>
<row>
<entry>mm</entry>
<entry>The two-digit minute. Single-digit values are preceded by a zero.</entry>
</row>
<row>
<entry>M</entry>
<entry>The one- or two-digit month number.</entry>
</row>
<row>
<entry>MM</entry>
<entry>The two-digit month number. Single-digit values are preceded by a zero.</entry>
</row>
<row>
<entry>MMM</entry>
<entry>The three-character month abbreviation.</entry>
</row>
<row>
<entry>MMMM</entry>
<entry>The full month name.</entry>
</row>
<row>
<entry>t</entry>
<entry>The one-letter AM/PM abbreviation (that is, AM is displayed as <emphasis role="italic">A</emphasis>.)</entry>
</row>
<row>
<entry>tt</entry>
<entry>The two-letter AM/PM abbreviation (that is, AM is displayed as <emphasis role="italic">AM</emphasis>.)</entry>
</row>
<row>
<entry>yy</entry>
<entry>The last two digits of the year (that is, 2011 would be displayed as <emphasis role="italic">11</emphasis>.)</entry>
</row>
<row>
<entry>yyyy</entry>
<entry>The full year (that is, 2011 would be displayed as <emphasis role="italic">2011</emphasis>.)</entry>
</row>
</tbody></tgroup>
</table>
</para>
<para>
Body text can be added to the format string by enclosing it in single quotes. Spaces and punctuation marks do not need
to be quoted. <emphasis role="bold">Note:</emphasis> <emphasis role="italic">Nonformat characters that are not
delimited by single quotes will result in unpredictable display by the DTP control.</emphasis> To include a single
quote in the body text, use two consecutive single quotes.
</para>
<para>
<emphasis role="bold">Examples:</emphasis>
<programlisting>
<![CDATA[
dtp = self~newDateTimePicker(IDC_DTP)
formatStr = "'Today is: 'hh':'m':'s dddd MMM dd', 'yyyy"
dtp~setFormat(formatStr)
/* The display would look like, depending on the actual date:
Today is: 04:22:31 Wednesday Mar 02, 2011
*/
formatStr = "'Don''t forget' MMM dd',' yyyy"
dtp~setFormat(formatStr)
/* The display would look like, depending on the actual date:
Don't forget Mar 02, 2011
*/
-- Quotes for the comma are not needed so this
-- is also valid and produces the same output:
formatStr = "'Don''t forget' MMM dd, yyyy"
dtp~setFormat(formatStr)
/* The display would look like, depending on the actual date:
Don't forget Mar 02, 2011
*/
]]>
</programlisting>
</para>
</section> <!-- End section Format Strings -->
<section id="sctDTPCallback"><title>Callback Fields</title>
<para>
The date and time picker control supports <emphasis role="italic">call back fields</emphasis> within the
<link linkend="sctDTPFormatStrings">format</link> strings. The call back fields allow the programmer to display custom
information at the point of the call back field by allowing the control to query the application for information. For
instance, the control can query the application for what text to display in the call back field or the maximum length
the display text in a field will be.
</para>
<para>
The queries are done through <xref linkend="ovvEvents"/> notification messages from the control.
Specifically, the FORMAT and FORMATQUERY events connected using the <xref linkend="mthConnectDateTimePickerEvent"/>. The
programmer must respond to the event notification to ensure that the custom information is displayed properly. The response
comes from the <xref linkend="evtDateTimePickerFORMAT"/> and <xref linkend="evtDateTimePickerFORMATQUERY"/> event handlers.
</para>
<para>
Call back fields are declared using one or more capital <emphasis role="bold">X</emphasis> characters (ASCII Code 88)
in the format string. Unique callback fields are created by repeating the <emphasis role="bold">X</emphasis>
character. Thus, the format string: <computeroutput>"XX dddd MMM dd', 'yyy XXX"</computeroutput> contains two call
back fields. <emphasis role="bold">XX</emphasis> and <emphasis role="bold">XXX</emphasis>. When the FORMAT and
FORMATQUERY notifications are sent, they include the format string element that defined the call back field so that
the programmer can tell which call back field the notification is for.
</para>
</section> <!-- End section Callback Fields -->
<section id="sctMethodsDateTimePicker"><title>Method Table</title>
<para>
The following table provides links to the documentation for the primary methods and attributes used in working
with DateTimePicker objects, including the pertinent methods from other classes:
</para>
<table id="tblDateTimePickerMethods" frame="all">
<title>DateTimePicker Methods and Attributes</title>
<tgroup cols="2">
<colspec colwidth="1*" /><colspec colwidth="3*" />
<thead>
<row>
<entry>Method</entry>
<entry>Documentation</entry>
</row>
</thead>
<tbody>
<row>
<entry align="center"><emphasis role="bold">Useful External Methods</emphasis></entry>
<entry align="center"><emphasis role="bold"></emphasis></entry>
</row>
<row>
<entry><xref linkend="tmthNewDateTimePicker"/></entry>
<entry>Obtains a DateTimePicker object that represents a date and time picker control in a dialog.</entry>
</row>
<row>
<entry><xref linkend="tmthCreateDateTimePicker"/></entry>
<entry>Creates a DateTimePicker control in an <xref linkend="clsUserDialog"/>.</entry>
</row>
<row>
<entry><xref linkend="tmthConnectDateTimePickerEvent"/></entry>
<entry>Connects DateTimePicker event notifications to a Rexx dialog method.</entry>
</row>
<row>
<entry align="center"><emphasis role="bold">Instance Methods</emphasis></entry>
<entry align="center"><emphasis role="bold"></emphasis></entry>
</row>
<row>
<entry><xref linkend="mthCloseMonthCal"/></entry>
<entry>Closes the drop down month calendar if it is dropped down</entry>
</row>
<row>
<entry><xref linkend="mthGetDateTime"/></entry>
<entry>Retrieves the currently selected date and time for the DTP and returns it as a <computeroutput>DateTime</computeroutput> object.</entry>
</row>
<row>
<entry><xref linkend="mthGetIdealSizeClsDTP"/></entry>
<entry>Gets the size needed to display the date time picker control without clipping.</entry>
</row>
<row>
<entry><xref linkend="mthGetInfo"/></entry>
<entry>Returns a <computeroutput>Directory</computeroutput> object with information about the date time picker.</entry>
</row>
<row>
<entry><xref linkend="mthGetMonthCal"/></entry>
<entry>Returns the <xref linkend="clsMonthCalendar"/> object for a date and time picker's (DTP) child month calendar control.</entry>
</row>
<row>
<entry><xref linkend="mthGetMonthCalColor"/></entry>
<entry>Retrieves the color for the given portion of DTP control's child month calendar control.</entry>
</row>
<row>
<entry><xref linkend="mthGetMonthCalFont"/></entry>
<entry>Gets the font that the DTP control's child month calendar control is currently using.</entry>
</row>
<row>
<entry><xref linkend="mthGetMonthCalStyle"/></entry>
<entry>Retrieves the style keywords of the date and time picker's child month calendar control.</entry>
</row>
<row>
<entry><xref linkend="mthGetRangeClsDTP"/></entry>
<entry>Gets the current minimum and maximum allowable times for a date and time picker (DTP) control.</entry>
</row>
<row>
<entry><xref linkend="mthSetDateTime"/></entry>
<entry>Sets the date and time for the DTP control to that specified.</entry>
</row>
<row>
<entry><xref linkend="mthSetFormat"/></entry>
<entry>Sets the display of a date and time picker (DTP) control based the specified format string.</entry>
</row>
<row>
<entry><xref linkend="mthSetMonthCalColor"/></entry>
<entry>Sets the color for the specified portion of the DTP control's child month calendar control.</entry>
</row>
<row>
<entry><xref linkend="mthSetMonthCalFont"/></entry>
<entry>Sets the font to be used by the date and time picker control's child month calendar control.</entry>
</row>
<row>
<entry><xref linkend="mthSetMonthCalStyle"/></entry>
<entry>Sets the style for the DTP control's child month calendar control.</entry>
</row>
<row>
<entry><xref linkend="mthSetRangeClsDTP"/></entry>
<entry>Sets the minimum and maximum allowable dates / times for the date time picker control.</entry>
</row>
</tbody></tgroup>
</table>
</section>
<section id="tmthNewDateTimePicker" xreflabel="newDateTimePicker"><title>newDateTimePicker (dialog object method)</title>
<para>
<computeroutput>DateTimePicker</computeroutput> objects can not be instantiated by the programmer from Rexx code using a <emphasis
role="italic">new</emphasis>() method. Rather, a date and time picker object is obtained by using the <xref
linkend="mthNewDateTimePicker"/> method of the <xref linkend="chpDialogObject"/> object. The syntax is:
<programlisting>
<![CDATA[
>>-newDateTimePicker(--id--)---------------------><
]]>
</programlisting>
</para>
</section> <!-- End Dialog::newDateTimePicker() (dialog object method) -->
<section id="tmthCreateDateTimePicker" xreflabel="createDateTimePicker">
<title>createDateTimePicker (UserDialog method)</title>
<para>
A date and time picker control can be added to the dialog template of a <xref linkend="clsUserDialog" />) through the
<xref linkend="mthCreateDateTimePicker"/> method. The basic syntax is:
<programlisting>
<![CDATA[
>>-createDateTimePicker(-id-,--x-,--y-,--cx-,--cy-+----------+-+-------------+--><
+-,--style-+ +-,--attrName-+
]]>
</programlisting>
</para>
</section> <!-- End UserDialog::createDateTimePicker() (UserDialog method) -->
<section id="tmthConnectDateTimePickerEvent" xreflabel="connectDateTimePickerEvent">
<title>connectDateTimePickerEvent (dialog object method)</title>
<para>
To connect event notifications from a DTP control use the <xref linkend="mthConnectDateTimePickerEvent"/> method of the
<xref linkend="chpDialogObject"/> object. The basic syntax is:
<programlisting>
<![CDATA[
>>--connectDateTimePickerEvent(--id-,-evt--+----------+-+------------+-)------><
+-,--mName-+ +-,-wilReply-+
]]>
</programlisting>
</para>
</section> <!-- End EventNotification::connectDateTimePickerEvent() (dialog object method) -->
<section id="mthCloseMonthCal" xreflabel="closeMonthCal"><title>closeMonthCal</title>
<indexterm><primary>closeMonthCal</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>closeMonthCal</secondary></indexterm>
<programlisting>
<![CDATA[
>>--closeMonthCal--------------------------------><
]]>
</programlisting>
<para>
Closes the drop down month calendar control of the date time picker.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The method takes no arguments.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
The method always returns 0.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
This method causes the date time picker to destroy the month calendar control and to send the DTN_CLOSEUP
notification (the <xref linkend="evtDateTimePickerCLOSEUP"/> event notification) that the drop-down has been closed.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
<xref linkend="ovvRequiredWindows"/> Windows Vista or later.
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::closeMonthCal() -->
<section id="mthGetDateTime" xreflabel="getDateTime"><title>getDateTime</title>
<indexterm><primary>getDateTime</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getDateTime</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getDateTime----------------------------------><
]]>
</programlisting>
<para>
Retrieves the currently selected date and time for the DTP and returns it as a <computeroutput>DateTime</computeroutput> object.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
This method has no arguments.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
Returns a <computeroutput>DateTime</computeroutput> object representing the current selected date and time of the
DTP control. May return the .nil object if the DTP control has the SHOWNONE style and is in the <emphasis
role="italic">no date</emphasis> state. It is possible that an error may occur within the underlying DTP control
itself. If this is detected, 0 is returned.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
When the DTP has the SHOWNONE style, the control includes a check box allowing the user to indicate that <emphasis
role="italic">no</emphasis> date is selected. In this case the <computeroutput>.nil</computeroutput> object is
returned to indicate that no date is selected.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Sets the <xref linkend="dotSystemErrorCode"/> if an error occurs within the underlying DTP
control. The system error code is set this way by the ooDialog framework:
<variablelist>
<varlistentry><term><emphasis role="bold">ERROR_INVALID_MESSAGE (1002)</emphasis></term>
<listitem>
<para>
The window cannot act on the sent message. <emphasis role="bold">Meaning:</emphasis> The underlying DTP control
returned an error rather than the selected data and time.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getDateTime() -->
<section id="mthGetIdealSizeClsDTP" xreflabel="getIdealSize"><title>getIdealSize</title>
<indexterm><primary>getIdealSize</primary><secondary>>DateTimePicker class</secondary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getIdealSize</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getIdealSize(--size--)-----------------------><
]]>
</programlisting>
<para>
Gets the size needed to display the date time picker control without clipping.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single required argument is:
<variablelist>
<varlistentry><term>size [required] [in / out]</term>
<listitem>
<para>
A <xref linkend="clsSize"/> object in which the ideal size is returned.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
Returns true always because the method always succeeds.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
<xref linkend="ovvRequiredWindows"/> Windows Vista or later.
</para>
<para>
Raises syntax errors when incorrect usage is detected.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example sets a longish format for a DTP control and then resizes the control to its ideal size:
<programlisting>
<![CDATA[
::method initDialog
expose dtp
dtp = self~newDateTimePicker(IDC_DTP);
format = 'dddd MMMM d, yyyy - h:mm tt'
dtp~setFormat(format)
time = .DateTime~fromISODate('2011-03-01T10:00:00.000000')
dtp~setDateTime(time)
ideal = .Size~new
dtp~getIdealSize(ideal)
dtp~resizeTo(ideal)
...
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getIdealSize() -->
<section id="mthGetInfo" xreflabel="getInfo"><title>getInfo</title>
<indexterm><primary>getInfo</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getInfo</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getInfo--------------------------------------><
]]>
</programlisting>
<para>
Returns a <computeroutput>Directory</computeroutput> object with information about the date time picker.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
This method takes no arguments.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
Returns a <computeroutput>Directory</computeroutput> object whose indexes contain information concerning the DTP
control. The indexes of the <computeroutput>Directory</computeroutput> object will be:
</para>
<variablelist>
<varlistentry><term>CHECKRECT</term>
<listitem>
<para>
This index is a <xref linkend="clsRect"/> object that contains the location of the check box allowing
the user to have no date selected. This check box is only present when the DTP control has the SHOWNONE style.
When the check box is not present, the coordinates of the rectangle will be all zeros.
</para>
</listitem></varlistentry>
<varlistentry><term>CHECKSTATE</term>
<listitem>
<para>
A localized string describing the state of the check box allowing the user to have no date selected. This check
box is only present when the DTP control has the SHOWNONE style. The operating system associates one or more
states with any object at any given time.
</para>
<para>
The string at index CHECKSTATE is the string the operating system returns to describe an object's state.
Microsoft's documentation is a little vague on exactly what the string will be. However, from testing it appears
the string will be <emphasis role="italic">invisible</emphasis> when the check box is not present. When the check
box is present, it appears the string will be <emphasis role="italic">checked</emphasis> or <emphasis
role="italic">normal</emphasis>.
</para>
</listitem></varlistentry>
<varlistentry><term>BUTTONRECT</term>
<listitem>
<para>
A <xref linkend="clsRect"/> object that contains the location of the button that shows the drop down
calendar when the user clicks on it. (Or closes the month calendar if the user clicks on it when the month
calendar is already open.) This button is not present if the DTP control has the UPDOWN style, in which case the
coordinates of the rectangle will be all zeros.
</para>
</listitem></varlistentry>
<varlistentry><term>BUTTONSTATE</term>
<listitem>
<para>
The BUTTONSTATE index is similar to the CHECKSTATE index. Its value is a localized string describing the state of
the button for the drop down month calendar. When the DTP control has the UPDOWN style and the button is not
present, the string is <emphasis role="italic">invisible</emphasis>. When the month calendar is showing the state
of the button is <emphasis role="italic">pressed</emphasis>, when it is not showing the state will be either
<emphasis role="italic">normal</emphasis> or <emphasis role="italic">unavailable</emphasis>. The state is
<emphasis role="italic">unavailable</emphasis> if the DTP control has the SHOWNONE style and no date is currently
selected.
</para>
</listitem></varlistentry>
<varlistentry><term>EDIT</term>
<listitem>
<para>
This index will either be an <xref linkend="clsEdit"/> object, or <computeroutput>.nil</computeroutput>,
depending on whether the DTP control currently has a child edit control or not. The DTP control will only have an
edit control when the DTP control has the CANPARSE style. The CANPARSE style allows the user to edit within the client
area of the control when they press the F2 key, or single click on the client area of the DTP control when the
control already has the focus. The child edit control is only present when the user is actively editing.
</para>
</listitem></varlistentry>
<varlistentry><term>DROPDOWN</term>
<listitem>
<para>
This index will either be a <xref linkend="clsMonthCalendar"/> object, or
<computeroutput>.nil</computeroutput>, depending on whether the DTP control currently has a child month calendar
control or not.
</para>
</listitem></varlistentry>
<varlistentry><term>UPDOWN</term>
<listitem>
<para>
This index will either be an <xref linkend="clsUpDown"/> object, or
<computeroutput>.nil</computeroutput>, depending on whether the DTP control currently has a child updown control
or not. The up down control will only exist when the DTP control has the UPDOWN style. With the UPDOWN style, the
normal drop down month calendar is replaced by an up down control.
</para>
</listitem></varlistentry>
</variablelist>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
<xref linkend="ovvRequiredWindows"/> Windows Vista or later.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example connects the <computeroutput>F3</computeroutput> key to the dialog. When the user presses the
<computeroutput>F3</computeroutput> key, the current DTP control information is displayed:
<programlisting>
<![CDATA[
::method defineDialog
self~createDateTimePicker(200, 10, 7, 280, 15, "BORDER SHORT SHOWNONE")
...
::method initDialog
expose dateTime
dateTime = self~newDateTimePicker(IDC_DTP_BIRTHDAY);
dateTime~setFormat("XX 'is on: 'hh':'mm':'ss dddd MMM dd', 'yyyy XXX")
self~connectKeyPress(onF3, .VK~f3)
...
::method onF3 unguarded
expose dateTime
info = dateTime~getInfo
say 'CheckRect: ' info~checkRect
say 'CheckState: ' info~checkState
say 'ButtonRect: ' info~buttonRect
say 'ButtonState:' info~buttonState
say 'DropDown: ' info~dropDown
say 'Edit: ' info~edit
say 'UpDown: ' info~upDown
say
/* As the user presses F3 at various times the output could be:
CheckRect: a Rect (2, 2, 22, 22)
CheckState: checked
ButtonRect: a Rect (386, 0, 420, 24)
ButtonState: normal
DropDown: The NIL object
Edit: The NIL object
UpDown: The NIL object
CheckRect: a Rect (2, 2, 22, 22)
CheckState: checked
ButtonRect: a Rect (386, 0, 420, 24)
ButtonState: pressed
DropDown: a MonthCalendar
Edit: The NIL object
UpDown: The NIL object
CheckRect: a Rect (2, 2, 22, 22)
CheckState: normal
ButtonRect: a Rect (386, 0, 420, 24)
ButtonState: unavailable
DropDown: The NIL object
Edit: The NIL object
UpDown: The NIL object
*/
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getInfo() -->
<section id="mthGetMonthCal" xreflabel="getMonthCal"><title>getMonthCal</title>
<indexterm><primary>getMonthCal</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getMonthCal</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getMonthCal----------------------------------><
]]>
</programlisting>
<para>
Returns the <xref linkend="clsMonthCalendar"/> object for a date and time picker's (DTP) child
month calendar control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
This method takes no arguments.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
A <computeroutput>MonthCalendar</computeroutput> object for the underlying child month calendar, if the child
control exists, otherwise the <computeroutput>.nil</computeroutput> object.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
<emphasis role="bold">Note:</emphasis> The following information mostly applies to Windows XP and earlier. For
Windows Vista and later the date and time picker control has the <xref linkend="mthSetMonthCalStyle"/> and
<xref linkend="mthGetMonthCalStyle"/> methods to directly manipulate the month calendar control's styles.
</para>
<para>
Obtaining the month calendar control allows the programmer to change its style or appearance. For instance the
<xref linkend="mthSetFirstDayOfWeek"/> day of the week could be changed or the <emphasis
role="italic">Go To Today</emphasis> could be removed by setting the NOTODAY style.
</para>
<para>
DTP controls do not create a static month calendar control. Rather, they create the month calendar when needed and
destroy the month calendar as soon as it is not needed. The <xref linkend="evtDateTimePickerDROPDOWN"/> notification is
sent after the DTP creates the month calendar and the <xref linkend="evtDateTimePickerCLOSEUP"/> notification is sent
when the month calendar is destroyed.
</para>
<para>
After the underlying month calendar control is destroyed, Rexx month calendar object is no longer valid.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example will work on any version of Windows that ooDialog supports. It gets the month calendar for the DTP
control and changes the first day of the week to Friday. The <emphasis role="italic">Today</emphasis> selection is
also removed. This is an example of a <xref linkend="evtDateTimePickerDROPDOWN"/> event handler. Note that no reference
is kept for the month calendar. The object will be invalid as soon as the user closes the drop down:
<programlisting>
<![CDATA[
::method onDropDown unguarded
use arg idFrom, hwndFrom
dt = self~newDateTimePicker(IDC_DTP);
monthCal = dt~getMonthCal
monthCal~setFirstDayOfWeek('Friday')
monthCal~addStyle("NOTODAY")
return 0
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getMonthCal() -->
<section id="mthGetMonthCalColor" xreflabel="getMonthCalColor"><title>getMonthCalColor</title>
<indexterm><primary>getMonthCalColor</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getMonthCalColor</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getMonthCalColor(--calendarPart--)-----------><
]]>
</programlisting>
<para>
Retrieves the color for the given portion of DTP control's child month calendar control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single argument is:
<variablelist>
<varlistentry><term>calendarPart [required]</term>
<listitem>
<para>
A single keyword specifying which part of the calendar to get the color for, case is not significant. The valid
keywords are:
</para>
<para>
<simplelist type='vert' columns='3'>
<member>BACKGROUND </member>
<member>MONTHBK </member>
<member>TEXT </member>
<member>TITLEBK </member>
<member>TITLETEXT </member>
<member>TRAILINGTEXT</member>
<member></member>
</simplelist>
<variablelist>
<varlistentry><term>BACKGROUND</term>
<listitem>
<para>
Retrieves the background color displayed between months.
</para>
</listitem></varlistentry>
<varlistentry><term>MONTHBK</term>
<listitem>
<para>
Retrieves the background color displayed within the month.
</para>
</listitem></varlistentry>
<varlistentry><term>TEXT</term>
<listitem>
<para>
Retrieves the color used to display text within a month.
</para>
</listitem></varlistentry>
<varlistentry><term>TITLEBK</term>
<listitem>
<para>
Retrieves the background color displayed in the calendar's title.
</para>
</listitem></varlistentry>
<varlistentry><term>TITLETEXT</term>
<listitem>
<para>
Retrieves the color used to display text within the calendar's title.
</para>
</listitem></varlistentry>
<varlistentry><term>TRAILINGTEXT</term>
<listitem>
<para>
Retrieves the color used to display header day and trailing day text. Header and trailing days are the days
from the previous and following months that appear on the current month calendar.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
On success, returns a COLORREF representing the color setting for the part of the month calendar control specified.
returns CLR_INVALID on error.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
This method is essentially the same as the <xref linkend="mthGetColor"/> method of the <xref linkend="clsMonthCalendar"/>
class, except that DTP control is asked to get the color from its child month calendar.
</para>
<para>
The <xref linkend="clsImage"/> class has a number of convenience methods for working with COLORREFs,
including the <xref linkend="mthColorRef"/> method that explains what a COLORREF is.
</para>
<para>
The <emphasis role="italic">colorRef</emphasis> method can be used to test the return for error. I.e.:
<computeroutput>.Image~colorRef(CLR_INVALID)</computeroutput>. (An error is not very likely.)
</para>
<para>
Note that many of the underlying dialog controls ignore their color settings when visual themes are enabled, unless
the theme is Windows Classic. This is the case for the month calendar control.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Raises syntax errors when incorrect arguments are detected.
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getMonthCalColor() -->
<section id="mthGetMonthCalFont" xreflabel="getMonthCalFont"><title>getMonthCalFont</title>
<indexterm><primary>getMonthCalFont</primary></indexterm>
<indexterm><primary>DateTimePicker</primary><secondary>getMonthCalFont</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getMonthCalFont------------------------------><
]]>
</programlisting>
<para>
Gets the font that the DTP control's child month calendar control is currently using.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
There are no arguments for this method.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
The return is a <xref linkend="defHandle"/> to the font, the same return as the <xref linkend="mthGetFont"/> or <xref
linkend="mthCreateFontEx"/> methods of the <xref linkend="chpDialogObject"/> object would return.
</para> </listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
Note that many of the underlying dialog controls ignore their font and color settings when visual themes are
enabled, unless the theme is Windows Classic. This is the case for the month calendar control.
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getMonthCalFont() -->
<section id="mthGetMonthCalStyle" xreflabel="getMonthCalStyle"><title>getMonthCalStyle</title>
<indexterm><primary>getMonthCalStyle</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getMonthCalStyle</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getMonthCalStyle-----------------------------><
]]>
</programlisting>
<para>
Retrieves the style keywords of the date and time picker's child month calendar control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
This method does not have any arguments.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
A list of <xref linkend="clsMonthCalendar"/> style keywords separated by spaces. The list may be
empty, otherwise it will contain one or more of the following keywords.
</para>
<para>
<simplelist type='vert' columns='3'>
<member>DAYSTATE </member>
<member>MULTI </member>
<member>NOTODAY </member>
<member>NOCIRCLE </member>
<member>WEEKNUMBERS</member>
<member>NOTRAILING </member>
<member>SHORTDAYS </member>
<member>NOSELCHANGE</member>
</simplelist>
<variablelist>
<varlistentry><term>DAYSTATE</term>
<listitem>
<para>
The month calendar will send the GETDAYSTATE <xref linkend="ovvEvents"/> notification to request
information about which days should be displayed in bold. For the DTP control's child month calendar, this style
is not of much interest, and not of much use, to the ooDialog programmer. The ooDialog can not connect an event
handler to the child month calendar.
</para>
</listitem></varlistentry>
<varlistentry><term>MULTI</term>
<listitem>
<para>
This style allows the user to select a range of dates within the control. By default, the maximum range is one
week. The programmer changes the maximum range that can be selected by using the <xref linkend="mthSetMaxSelection"/>
method. Again, this style is not relevant for the DTP control's child month calendar control. The DTP control
only supports a specific date, a range of dates is not supported.
</para> </listitem></varlistentry>
<varlistentry><term>NOTODAY</term>
<listitem>
<para>
The month calendar control will not display the <emphasis role="italic">today</emphasis> date at the bottom of the control.
</para>
</listitem></varlistentry>
<varlistentry><term>NOCIRCLE</term>
<listitem>
<para>
The month calendar control will not circle the <emphasis role="italic">today</emphasis> date at the bottom of
the control.
</para>
</listitem></varlistentry>
<varlistentry><term>WEEKNUMBERS</term>
<listitem>
<para>
The month calendar displays week numbers (1-52) to the left of each row of days. Week 1 is defined by
Microsoft as the first week that contains at least four days.
</para>
</listitem></varlistentry>
<varlistentry><term>NOTRAILING</term>
<listitem>
<para>
<emphasis role="bold">Windows Vista or later only</emphasis>. This style disables displaying the dates from the
previous / next month in the current calendar.
</para>
</listitem></varlistentry>
<varlistentry><term>SHORTDAYS</term>
<listitem>
<para>
<emphasis role="bold">Windows Vista or later only</emphasis>. With this style, the month calendar uses the
shortest day name for the label of the day of the week column header.
</para>
</listitem></varlistentry>
<varlistentry><term>NOSELCHANGE</term>
<listitem>
<para>
<emphasis role="bold">Windows Vista or later only</emphasis>. With this style the selection does not change when
the user navigates to the next or previous month in the calendar. This style is needed for the user to be able
to select a range greater than what is currently displayed. This style is also not relevant for
the same reasons as given for the MULTI style.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
<xref linkend="ovvRequiredWindows"/> Windows Vista or later.
</para>
</listitem></varlistentry>
<varlistentry id="exampleGetMonthCalStyle"><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example shows a simple exploratory program that could be written to see what the default style for the DTP
control's child month calendar is. Note that, in the author's experience, the child month calendar does not have any
styles set.
</para>
<para>
For an expanded version of this example, see the <link linkend="exampleSetMonthCalStyle">example</link> for the
<xref linkend="mthSetMonthCalStyle"/> method.
<programlisting>
<![CDATA[
/*
* Simple test program to display the DTP control's month calendar's initial
* style.
*/
if \ .OS~isAtLeastVista then do
say "Sorry this example program is for Windows Vista or later."
return 99
end
.application~useGlobalConstDir('O')
.constDir[IDC_DTP] = 200
dlg = .TestDialog~new
dlg~execute("SHOWTOP")
return 0
::requires "ooDialog.cls"
::class 'TestDialog' subclass UserDialog
::method init
forward class (super) continue
self~createCenter(200, 100, 'Dialog', , , 'MS Shell Dlg 2', 8)
::method defineDialog
self~createDateTimePicker(IDC_DTP, 10, 7, 180, 15, "SHORT")
self~createPushButton(IDOK, 140, 74, 50, 14, "DEFAULT", "Ok")
self~connectDateTimePickerEvent(IDC_DTP, "DROPDOWN", onDropDown)
::method onDropDown unguarded
use arg idFrom, hwndFrom
dtp = self~newDateTimePicker(IDC_DTP)
say "Style:" dtp~getMonthCalStyle
return 0
/* Ouptut will be:
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getMonthCalStyle() -->
<section id="mthGetRangeClsDTP" xreflabel="getRange"><title>getRange</title>
<indexterm><primary>getRange</primary><secondary>DateTimePicker class</secondary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>getRange</secondary></indexterm>
<programlisting>
<![CDATA[
>>--getRange(--range--)--------------------------><
]]>
</programlisting>
<para>
Gets the current minimum and maximum allowable times for a date and time picker (DTP) control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single required argument is:
<variablelist>
<varlistentry><term>range [required] [in / out]</term>
<listitem>
<para>
An <computeroutput>Array</computeroutput> object in which the minimum and maximum times are returned as
<computeroutput>DateTime</computeroutput> objects. The minimum time will be at index 1 and the maximum at index
2. If either index is set to zero, then no corresponding limit is set for the date time picker control.
</para> </listitem></varlistentry>
</variablelist> </para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
The return will be a keyword indicating the result. See the Remarks section for possible keywords.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
The returned keyword will be exactly one of: <computeroutput>none, min, max, both, error</computeroutput> describing
which limit(s) are set. The <emphasis role="italic">error</emphasis> keyword would indicate an error occurred with
the DTP control, but that is very unlikely.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Raises syntax errors when incorrect arguments are detected.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example shows a method designed to display the current range of the DTP control:
<programlisting>
<![CDATA[
::method showRange
expose dtp
min_max = .array~new(2)
keyword = dtp~getRange(min_max)
select
when keyword == 'none' then do
say "There are no minimum or maximum times set for the DTP control."
end
when keyword == 'min' then do
say "The minimum time for the DTP control is:" min_max[1]'.'
say 'There is no maximum time set.'
end
when keyword == 'max' then do
say "The maximum time for the DTP control is:" min_max[2]'.'
say 'There is no minimum time set.'
end
when keyword == 'both' then do
say "The minimum time for the DTP control is:" min_max[1]'.'
say "The maximum time for the DTP control is:" min_max[2]'.'
end
when keyword == 'error' then do
say 'An unexplained error occurred.'
end
otherwise do
-- This is not possible
nop
end
end
-- End select
/* Output might for instance be:
The minimum time for the DTP control is: 2011-01-01T00:00:00.000000.
The maximum time for the DTP control is: 2011-12-31T11:59:59.999000.
*/
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::getRange() -->
<section id="mthSetDateTime" xreflabel="setDateTime"><title>setDateTime</title>
<indexterm><primary>setDateTime</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>setDateTime</secondary></indexterm>
<programlisting>
<![CDATA[
>>--setDateTime(--dateTime--)--------------------><
]]>
</programlisting>
<para>
Sets the date and time for the DTP control to that specified.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single required argument is:
<variablelist>
<varlistentry><term>dateTime [required]</term>
<listitem>
<para>
A <computeroutput>DateTime</computeroutput> object that specifies the date and time to set the DTP to. However, if
the DTP control has the SHOWNONE style, the <emphasis role="italic">dateTime</emphasis> argument can be the
<computeroutput>.nil</computeroutput> object to set the DTP control to the <emphasis role="italic">no
date</emphasis> state.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
Returns 0, always.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
When the DTP control has the SHOWNONE style, it is possible to have no date currently selected. The control displays
a check box that is automatically selected whenever a date is picked or entered. If the check box is subsequently
deselected, the application cannot retrieve the date from the control because, in essence, the control has no date.
The <emphasis role="italic">no date</emphasis> state can be set with the <emphasis
role="italic">setDateTime</emphasis> method and queried by using the <xref linkend="mthGetDateTime"/> method.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Raises syntax errors when incorrect usage is detected.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example sets the date and time of the DTP control to March 1st, 2011 at 10:00 am:
<programlisting>
<![CDATA[
::method initDialog
expose dtp
dtp = self~newDateTimePicker(IDC_DTP);
time = .DateTime~fromISODate('2011-03-01T10:00:00.000000')
dtp~setDateTime(time)
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::setDateTime() -->
<section id="mthSetFormat" xreflabel="setFormat"><title>setFormat</title>
<indexterm><primary>setFormat</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>setFormat</secondary></indexterm>
<programlisting>
<![CDATA[
>>--setFormat(--format--)------------------------><
]]>
</programlisting>
<para>
Sets the display of a date and time picker (DTP) control based the specified <link
linkend="sctDTPFormatStrings">format</link> string.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single required argument is:
<variablelist>
<varlistentry><term>format [required]</term>
<listitem>
<para>
A <link linkend="sctDTPFormatStrings">format</link> string that dictates how the DTP control formats the data and time
in its display.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
Returns true on success, false on error.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Raises syntax errors when incorrect arguments are detected.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example creates a format string and then sets the DTP to use it:
<programlisting>
<![CDATA[
::method initDialog
expose dtp
dtp = self~newDateTimePicker(IDC_DTP);
format = 'dddd MMMM d, yyyy - h:mm tt'
dtp~setFormat(format)
/* Display will look like this, for example, depending on exact
date and time:
Monday October 24, 2011 - 11:52 AM
*/
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::setFormat() -->
<section id="mthSetMonthCalColor" xreflabel="setMonthCalColor"><title>setMonthCalColor</title>
<indexterm><primary>setMonthCalColor</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>setMonthCalColor</secondary></indexterm>
<programlisting>
<![CDATA[
>>--setMonthCalColor(--which--,--color--)--------><
]]>
</programlisting>
<para>
Sets the color for the specified portion of the DTP control's child month calendar control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The arguments are:
<variablelist>
<varlistentry><term>which [required]</term>
<listitem>
<para>
Specifies which part of the calendar will have its color set. Exactly one of the following keywords must be used,
case is not significant:
</para>
<para>
<simplelist type='vert' columns='3'>
<member>BACKGROUND </member>
<member>MONTHBK </member>
<member>TEXT </member>
<member>TITLEBK </member>
<member>TITLETEXT </member>
<member>TRAILINGTEXT</member>
</simplelist>
<variablelist>
<varlistentry><term>BACKGROUND</term>
<listitem>
<para>
Set the background color displayed between months.
</para>
</listitem></varlistentry>
<varlistentry><term>MONTHBK</term>
<listitem>
<para>
Set the background color displayed within the month.
</para>
</listitem></varlistentry>
<varlistentry><term>TEXT</term>
<listitem>
<para>
Set the color used to display text within a month.
</para>
</listitem></varlistentry>
<varlistentry><term>TITLEBK</term>
<listitem>
<para>
Set the background color displayed in the calendar's title.
</para>
</listitem></varlistentry>
<varlistentry><term>TITLETEXT</term>
<listitem>
<para>
Set the color used to display text within the calendar's title.
</para>
</listitem></varlistentry>
<varlistentry><term>TRAILINGTEXT</term>
<listitem>
<para>
Set the color used to display header day and trailing day text. Header and trailing days are the days
from the previous and following months that appear on the current month calendar.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term>color [required]</term>
<listitem>
<para>
The color, specified as a COLORREF, to set the specified calendar part.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
On success, returns the previous color, as a COLORREF, for the part of the month calendar control specified.
Returns CLR_INVALID on error.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
The <xref linkend="clsImage"/> class has a number of convenience methods for working with COLORREFs,
including the <xref linkend="mthColorRef"/> method that explains what a COLORREF is.
</para>
<para>
The <emphasis role="italic">colorRef</emphasis> method can be used to test the return for error. I.e.:
<computeroutput>.Image~colorRef(CLR_INVALID)</computeroutput>. (An error is not very likely.)
</para>
<para>
Note that many of the underlying dialog controls ignore their font and color settings when visual themes are
enabled, unless the theme is Windows Classic. This is the case for the month calendar control.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Raises syntax errors when incorrect arguments are detected.
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::setMonthCalColor() -->
<section id="mthSetMonthCalFont" xreflabel="setMonthCalFont"><title>setMonthCalFont</title>
<indexterm><primary>setMonthCalFont</primary></indexterm>
<indexterm><primary>DateTimePicker</primary><secondary>setMonthCalFont</secondary></indexterm>
<programlisting>
<![CDATA[
>>--setMonthCalFont(--newFont--+-----------+--)--><
+-,-redraw--+
]]>
</programlisting>
<para>
Sets the font to be used by the date and time picker control's child month calendar control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The arguments are:
<variablelist>
<varlistentry><term>newFont [required]</term>
<listitem>
<para>
The new font for the child month calendar. One way to obtain a font is though the <xref linkend="mthCreateFontEx"/>
method.
</para>
</listitem></varlistentry>
<varlistentry><term>redraw [optional]</term>
<listitem>
<para>
Specifies whether the month calendar control should redraw itself immediately upon setting the font. The default
is true, which causes the control to redraw itself immediately.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
xx
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
Note that many of the underlying dialog controls ignore their font and color settings when visual themes are
enabled, unless the theme is Windows Classic. This is the case for the month calendar control.
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::setMonthCalFont() -->
<section id="mthSetMonthCalStyle" xreflabel="setMonthCalStyle"><title>setMonthCalStyle</title>
<indexterm><primary>setMonthCalStyle</primary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>setMonthCalStyle</secondary></indexterm>
<programlisting>
<![CDATA[
>>--setMonthCalStyle(--style--)------------------><
]]>
</programlisting>
<para>
Sets the style for the DTP control's child month calendar control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single required argument is:
<variablelist>
<varlistentry><term>style [required]</term>
<listitem>
<para>
A list of <xref linkend="clsMonthCalendar"/> style keywords separated by spaces. The list may
be empty. This will revert the month calendar to its default style. Otherwise, it can contain one or more of the
following keywords.
</para>
<para>
<simplelist type='vert' columns='3'>
<member>DAYSTATE </member>
<member>MULTI </member>
<member>NOTODAY </member>
<member>NOCIRCLE </member>
<member>WEEKNUMBERS</member>
<member>NOTRAILING </member>
<member>SHORTDAYS </member>
<member>NOSELCHANGE</member>
</simplelist>
<variablelist>
<varlistentry><term>DAYSTATE</term>
<listitem>
<para>
The month calendar will send the GETDAYSTATE <xref linkend="ovvEvents"/> notification to request
information about which days should be displayed in bold. For the DTP control's child month calendar, this style
is not of much interest, and not of much use, to the ooDialog programmer. The ooDialog can not connect an event
handler to the child month calendar.
</para>
</listitem></varlistentry>
<varlistentry><term>MULTI</term>
<listitem>
<para>
This style allows the user to select a range of dates within the control. By default, the maximum range is one
week. The programmer changes the maximum range that can be selected by using the <xref
linkend="mthSetMaxSelection"/> method. Again, this style is not relevant for the DTP control's child month calendar
control. The DTP control only supports a specific date, a range of dates is not supported.
</para>
</listitem></varlistentry>
<varlistentry><term>NOTODAY</term>
<listitem>
<para>
The month calendar control will not display the <emphasis role="italic">today</emphasis> date at the bottom of the control.
</para>
</listitem></varlistentry>
<varlistentry><term>NOCIRCLE</term>
<listitem>
<para>
The month calendar control will not circle the <emphasis role="italic">today</emphasis> date at the bottom of
the control.
</para>
</listitem></varlistentry>
<varlistentry><term>WEEKNUMBERS</term>
<listitem>
<para>
The month calendar displays week numbers (1-52) to the left of each row of days. Week 1 is defined by
Microsoft as the first week that contains at least four days.
</para>
</listitem></varlistentry>
<varlistentry><term>NOTRAILING</term>
<listitem>
<para>
<emphasis role="bold">Requires Windows Vista or later</emphasis>. This style disables displaying the dates
from the previous / next month in the current calendar.
</para>
</listitem></varlistentry>
<varlistentry><term>SHORTDAYS</term>
<listitem>
<para>
<emphasis role="bold">Requires Windows Vista or later</emphasis>. With this style, the month calendar uses the
shortest day name for the label of the day of the week column header.
</para>
</listitem></varlistentry>
<varlistentry><term>NOSELCHANGE</term>
<listitem>
<para>
<emphasis role="bold">Requires Windows Vista or later</emphasis>. With this style the selection does not
change when the user navigates to the next or previous month in the calendar. This style is needed for the
user to be able to select a range greater than what is currently displayed. This style is also not relevant for
the same reasons as given for the MULTI style.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
The return value is a list of style keywords, (see the <emphasis role="italic">style</emphasis> argument above,)
defining the style the child month calendar had previously.
</para>
</listitem></varlistentry>
<varlistentry id="exampleSetMonthCalStyle"><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example is a stand-alone program. It is a slightly expanded version of the <emphasis
role="italic">getMonthCalStyle</emphasis> <link linkend="exampleGetMonthCalStyle">example</link>.
<programlisting>
<![CDATA[
/*
* Simple test program to set and show the DTP control's month calendar's
* initial style.
*/
.application~useGlobalConstDir('O')
.constDir[IDC_DTP] = 200
dlg = .TestDialog~new
dlg~execute("SHOWTOP")
return 0
::requires "ooDialog.cls"
::class 'TestDialog' subclass UserDialog
::method init
forward class (super) continue
self~createCenter(200, 100, 'Dialog', , , 'MS Shell Dlg 2', 8)
::method defineDialog
self~createDateTimePicker(IDC_DTP, 10, 7, 180, 15, "SHORT")
self~createPushButton(IDOK, 140, 74, 50, 14, "DEFAULT", "Ok")
self~connectDateTimePickerEvent(IDC_DTP, "DROPDOWN", onDropDown)
self~connectDateTimePickerEvent(IDC_DTP, "CLOSEUP", onDropDown)
::method initDialog
expose dtp
dtp = self~newDateTimePicker(IDC_DTP);
if .OS~isAtLeastVista then do
dtp~setMonthCalStyle("NOCIRCLE NOTRAILING")
end
::method onDropDown unguarded
expose dtp
use arg idFrom, hwndFrom
if \ .OS~isAtLeastVista then do
mc = dtp~getMonthCal
mc~replaceStyle('DAYSTATE MULTI WEEKNUMBERS', "NOCIRCLE NOTODAY")
end
if .OS~isAtLeastVista then do
say "Style:" dtp~getMonthCalStyle
end
else do
say "Style (Windows 2000 or XP):" mc~getStyle
end
return 0
/* Ouptut on Vista or later will be:
Style: NOCIRCLE NOTRAILING
Output on Windows 2000 or XP:
Style (Windows 2000 or XP): NOCIRCLE NOTODAY
*/
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::setMonthCalStyle() -->
<section id="mthSetRangeClsDTP" xreflabel="setRange"><title>setRange</title>
<indexterm><primary>setRange</primary><secondary>DateTimePicker class</secondary></indexterm>
<indexterm><primary>DateTimePicker class</primary><secondary>setRange</secondary></indexterm>
<programlisting>
<![CDATA[
>>--setRange(--dateTimes--)----------------------><
]]>
</programlisting>
<para>
Sets the minimum and maximum allowable dates / times for the date time picker control.
</para>
<variablelist>
<varlistentry><term><emphasis role="bold">Arguments:</emphasis></term>
<listitem>
<para>
The single required argument is:
<variablelist>
<varlistentry><term>dateTimes [required]</term>
<listitem>
<para>
An array of <computeroutput>DateTime</computeroutput> objects used to set the minimum and maximum dates. The
<computeroutput>DateTime</computeroutput> object at index 1 sets the minimum date and the
<computeroutput>DateTime</computeroutput> object at index 2 sets the maximum date.
</para>
</listitem></varlistentry>
</variablelist>
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Return value:</emphasis></term>
<listitem>
<para>
True on success, otherwise false.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Remarks:</emphasis></term>
<listitem>
<para>
The array must contain at least one of the indexes. If it contains neither, an exception is raised. If one of the
array indexes is empty, then the corresponding date is not set.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Details</emphasis></term>
<listitem>
<para>
Raises syntax errors when incorrect arguments are detected.
</para>
</listitem></varlistentry>
<varlistentry><term><emphasis role="bold">Example:</emphasis></term>
<listitem>
<para>
This example restricts the range of the DTP control to the year 2011:
<programlisting>
<![CDATA[
::method initDialog
expose dtp
dtp = self~newDateTimePicker(IDC_DTP);
min = .DateTime~fromUsaDate('01/01/11')
max = .DateTime~fromISODate('2011-12-31T23:59:59.999999')
dtp~setRange(.array~of(min, max))
]]>
</programlisting>
</para>
</listitem></varlistentry>
</variablelist>
</section> <!-- End DateTimePicker::setRange() -->
</chapter> <!-- End DateTimePicker class -->

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks