Widget Encyclopedia : WkNumericEditor

WkNumericEditor
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\wkctrl14a.jpg
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\wkctrl14.jpg
The WkNumericEditor widget provides a means for editing integer values. Since it is specifically designed for integers, WkNumericEditor ensures that only integers are entered. To further restrict valid values, the range of valid numbers can be bounded by minimum and a maximum values. 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.
 
editable: aBoolean
Specifies whether a user can edit text in the entry field part of the spin button.
 
increment: anInteger
Specifies the amount to increase or decrease a numeric spin button when the corresponding arrow is selected.
 
maximum: anInteger
Specifies a numeric spin button’s maximum value.
 
minimum: anInteger
Specifies a numeric spin button’s minimum value.
 
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\wkctrl14e.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.
 
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.
 
Increment
Specifies the amount to increase or decrease a numeric spin button when the corresponding arrow is selected.
 
Maximum
Specifies a numeric spin button’s maximum value.
 
Minimum
Specifies a numeric spin button’s minimum value.
 
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 WkNumericEditor with an initial value of 50 and a maximum and minimum bounds of 100 and –100 respectively. A center alignmnet has also been specified.
aWkNumericEditor := WkNumericEditor
createWidget: 'aWkNumericEditor'
parent: self form
argBlock: [:w | w
x: 48;
y: 77;
width: 148;
height: 24;
maximum: 100;
minimum: -100;
alignment: XmALIGNMENTCENTER;
value: 50;
increment: 5;
scale].