WkDateEditor
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\wkctrl3a.jpg
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\wkctrl3.jpg
The WkDateEditor, as its name implies, provides a convenient control for editing dates. It contains three fields for setting the month, day, and year of a date value. Since it is specifically designed for date manipulation, it assures that any date entered is guaranteed valid.
Date editors allow the user to edit a date by manipulating the month, day, and year fields as if they were each numeric editors. When a date widget receives the input focus, the first field becomes the current field. The current field can be selected by using the mouse or the left and right arrow keys. Once selected, a field (day, month, or year) can be edited using either the arrow buttons or by using the keyboard to type the value. Incrementing past the last day in a month or the last month in a year will increment the month or year.
WkDateEditor provides a variety of styles to allow for flexibility in choosing a date format. These styles mirror the settings dialog provided by Windows, and should allow all supported cultural date variations, including changing the separator (“/” by default), switching the order of the editors, and showing leading zeros or the full century.
The contents of a WkDateEditor is a Date object, both for setting and retrieving the current value. A user can increment or decrement the values using up/down arrow keys or by selecting the up/down buttons. A user can change the value in an editable spin button by typing in the entry field.
Protocol
alignment: anInteger
Specifies the text alignment used by the widget.
Default: XmALIGNMENTEND (Right)
Valid resource values:
XmALIGNMENTBEGINNING (Left) - Causes the left side of the line of text to be vertically aligned with the left edge of the widget window.
XmALIGNMENTCENTER (Center) - Causes the center of the line of text to be vertically aligned in the center of the widget window.
XmALIGNMENTEND (Right) - Causes the right side of the line of text to be vertically aligned with the right edge of the widget window.
 
allowNil: aBoolean
Specifies whether the text field may have a blank (nil) value.
 
date
Answers the date held by the widget.
 
date: aDate
Set the date held by the widget.
 
dayLeadingZero: aBoolean
Specifies whether the day field is displayed with a leading zero.
 
editable: aBoolean
Specifies whether a user can edit text in the entry field part of the spin button.
 
format: aSymbol
Specifies format in which the date is displayed.
Default: XmMDY (M/D/Y)
Valid resource values:
XmDM (D/M) - Day and Month only.
XmDMY (D/M/Y) - Day, Month and Year.
XmMD (M/D) - Month and Day only.
XmMDY (M/D/Y) - Month, Day and Year.
XmYDM (Y/D/M) - Year, Date and Month.
 
maximum: anInteger
Specifies a numeric spin button’s maximum value.
 
minimum: anInteger
Specifies a numeric spin button’s minimum value.
 
monthFormat: aSymbol
Specifies format in which the month is displayed.
Default: XmNUMBER (Number)
Valid resource values:
XmABBREVIATION (Abbreviated) - Abbreviated Name.
XmNUMBER (Number) - As number.
XmTEXT (Text) - Full Name.
 
monthLeadingZero: aBoolean
Specifies whether the month field is displayed with a leading zero.
 
separator: aString
Specifies the separator character(s) used to separate the date fields.
 
selectOnFocus: anInteger
Specifies which field is selected on gaining focus.
Default: XmSELECTLAST (Select Last)
Valid resource values:
XmSELECTLAST (Select Last) - Select the field that last had focus.
XmSELECTALL (Select All) - Selects all of the text of the widget.
XmSELECTDAY (Select Day) - Select the day field.
XmSELECTMONTH (Select Month) - Select the month field.
XmSELECTYEAR (Select Year) - Select the year field.
 
showCentury: aBoolean
Specifies whether the century is displayed or not.
 
value: aString
Specifies the initial value of the widget.
 
wrap: aBoolean
Specifies whether the spin button should cycle or stop upon reaching the end of the collection, or max or min for a numeric spin button.
Callbacks & Events
Activate Callback
These callbacks are triggered when the user presses the default action key. This is typically a carriage return.
 
Decrement Callback
These callbacks are triggered when the user decreases the spin button value by one step. This can happen either when the down arrow key is pressed or when the down arrow button is selected with the mouse.
 
Focus Callback
These callbacks are triggered before the entry field has accepted input focus.
 
Increment Callback
These callbacks are triggered when the user increases the spin button value by one step. This can happen either when the up arrow key is pressed or the up arrow button is selected with the mouse.
 
Losing Focus Callback
These callbacks are triggered before the entry field loses input focus.
 
Modify Verify Callback
These callbacks are triggered before text is deleted from or inserted into the widget. This callback can be used to check a character value after it is entered by the user and before it is accepted by the control.
Call data arguments:
doit - Indicates whether the action that invoked the callback is performed.
Setting doit to false negates the action.
text - a String which contains the text which is to be inserted.
currInsert - the current position of the insert cursor.
startPos - the starting position of the text to modify.
endPos - the ending position of the text to modify.
 
Value Changed Callback
These callbacks are triggered after text is deleted from or inserted into the widget. This callback can be used to retrieve the current value of the widget.
Editor
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\wkctrl3e.jpg
Alignment
Specifies the text alignment used by the widget.
Left - Causes the left side of the line of text to be vertically aligned with the left edge of the widget window.
Center - Causes the center of the line of text to be vertically aligned in the center of the widget window.
Right - Causes the right side of the line of text to be vertically aligned with the right edge of the widget window.
 
Allow Nil
Specifies whether the text field may have a blank (nil) value.
 
Border Width
Specifies the width of the border that surrounds the widget’s window on all four sides. The width is specified in pixels. A width of zero means that no border will show.
Border - Causes the widget to have a border.
No Border - Causes the widget to have no border.
 
Day Leading Zero
Specifies whether the day field is displayed with a leading zero.
 
Editable
Specifies whether a user can edit text in the entry field part of the spin button.
 
Enabled
Determines whether a widget will react to input events. Disabled (insensitive) widgets do not react to input events.
 
Format
Specifies format in which the date is displayed.
D/M - Day and Month only.
D/M/Y - Day, Month and Year.
M/D - Month and Day only.
M/D/Y - Month, Day and Year.
Y/D/M - Year, Date and Month.
 
Maximum
Specifies a numeric spin button’s maximum value.
 
Minimum
Specifies a numeric spin button’s minimum value.
 
Month Format
Specifies format in which the month is displayed.
Abbreviated - Abbreviated Name.
Number - As number.
Text - Full Name.
 
Month Leading Zero
Specifies whether the month field is displayed with a leading zero.
 
On Focus
Specifies which field is selected on gaining focus.
Select Last - Select the field that last had focus.
Select All - Selects all of the text of the widget.
Select Day - Select the day field.
Select Month - Select the month field.
Select Year - Select the year field.
 
Separator
Specifies the separator character(s) used to separate the date fields.
 
Show Century
Specifies whether the century is displayed or not.
Visible
Maps the widget (makes visible) as soon as it is both realized and managed, if set to True. If set to False, the client is responsible for mapping and unmapping the widget.
 
Value
Specifies the initial value of the widget.
 
Wrap
Specifies whether the spin button should cycle or stop upon reaching the end of the collection, or max or min for a numeric spin button.
Example
The following example code creates a WkDateEditor with a Day/Month/Year format where the month is displayed as an abbreviation (e.g., “JAN”), the separator character is a dash (“-”) and the leading zero on the day field is suppressed.
aWkDateEditor := WkDateEditor
createWidget: 'aWkDateEditor'
parent: self form
argBlock: [:w | w
x: 28;
y: 69;
width: 148;
height: 24;
format: XmDMY;
monthFormat: XmABBREVIATION;
separator: '-';
dayLeadingZero: false;
scale].
 
Last modified date: 11/16/2018