Totally Objects - Date and Time Editor Parts and Widgets (Version 5.5 [1.0])


This Totally Objects product for IBM's VisualAge for Smalltalk contains parts and widgets for adding date and time editors to windows.


This product has been packaged as three configuration maps. To import them into your library select 'Browse Configuration Maps' from the 'Tools' menu of the 'System Transcript'. In the 'Configuration Maps Browser' select 'Import...' from the 'Names' menu and select the file tobdted5-5_1-0-*.dat. You should then select the three configuration maps contained within this file:

To load the configuration maps into your image select each of them in the 'Configuration Maps Browser' select 'Load With Required Maps' from the 'Editions' menu.

If you are using the parts interface you will need to copy the directory 'tobdted' (which contains icons) into your root VAST directory.


The Widgets Interface

If you build your windows using parts (i.e. visual programming) then you will probably want to skip this section and jump straight to 'The Parts Interface'

Use the TobSimpleDateEditorWidget class to enable your users to edit dates. For convenience the method CwWidget>>#createTobSimpleDateEditor::argBlock: has been provided. The following methods can be used to configure the widget:

If a calendar style date editor is required then the class TobDateEditorWidget should be used. For convenience the method CwWidget>>#createTobDateEditor:argBlock: has been provided. This widget can be configured with the span class="selector">#date and #date: method as above and additionally:

Both of these date editor widgets have the callback #dateChangedCallback which can be handled to detect changes to the entered date. The call data for this callback is of type TobDateEditorCallbackData which has a public method #date for accessing the new date.

Use the TobTimeEditorWidget to enable your users to edit times. For convenience the method CwWidget>>#createTobTimeEditor:argBlock: has been provided. The following methods can be used to configure the widget:

The callback #timeChangedCallback can be handled to detect changes to the entered time. The call data for this callback is of type TobTimeEditorCallbackData which has a public method #time for accessing the new time.

The Parts Interface

Upon loading the 'Totally Objects, Date and Time Editors - Parts' configuration map, the parts TobSimpleDateEditorView, TobDateEditorView and TobTimeEditorView will be added to the 'Data Entry' category of the Parts Palette in the Composition Editor. These part have the following features (in addition to all the usual font, color etc. features):

TobSimpleDateEditorView - 'Simple Date Editor'



TobDateEditorView - 'Advanced Date Editor'



TobTimeEditorView - 'Time Editor'



The date editors use a threshold value to determine how years entered as two digits get interpreted. For example, should 68 mean 1968 or 2068?

The threshold value can be any Integer from 0 to 100 (inclusive) with default value of 50. The value identifies the number of 2-digit values that will be interpreted as future dates. For example, if the current year (i.e. Date today year) is 2002, and the threshold is 50 then years entered in the range 02 to 51 will be interpreted as 2002 to 2051 (i.e. in future); the years entered as 00 and 01 will be interpreted as 2000 and 2001 (i.e. in the past) and years entered in the range 52 to 99 will be interpreted as 1952 to 1999 (i.e. in the past). The table below compares different threshold values assuming the current year is 2002.

2-digit year threshold = 0 threshold = 30 threshold = 50 threshold = 100
00 2000 2000 2000 2100
01 2001 : : 2101
02 1902 : : 2002
: : : : :
31 : 2031 : :
32 : 1932 : :
: : : : :
51 : : 2015 :
52 : : 1952 :
: : : : :
99 1999 1999 1999 2099

So if your user is entering a date on which to finish his mortgage then set the threshold to 100 as he is unlikely to want to enter a year before the the current year. On the other hand, if the user is entering his birth date, set the threshold to 1 so that the value entered will either be interpreted as the current year or some year in the past. Often a threshold somewhere between these values is needed (hence the default of 50).

Further Information