
BBjWindow::addInputNSpinner
Description
In BBj 7.0 and higher, this method creates a BBjInputNSpinner on the BBjWindow.
Syntax
Return Value |
Method |
---|---|
addInputNSpinner(int ID, int x, int y, int w, int h) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, int min, int max) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$, float min, float max) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$, string mask$) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$, string mask$, float min, float max) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$, string mask$, string rules$) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$, string mask$, string rules$, float restore, float value) |
|
addInputNSpinner(int ID, int x, int y, int w, int h, string flags$, string mask$, string rules$, float restore, float value, float min, float max) |
|
addInputNSpinner(int ID) |
|
addInputNSpinner(int ID, int min, int max) |
|
addInputNSpinner(int ID, string flags$) |
|
addInputNSpinner(int ID, string flags$, int min, int max) |
|
addInputNSpinner(int ID, string flags$, string mask$) |
|
addInputNSpinner(int ID, string flags$, string mask$, int min, int max) |
|
addInputNSpinner(int ID, string flags$, string mask$, string rules$) |
|
addInputNSpinner(int ID, string flags$, string mask$, string rules$, int restore, int value) |
|
addInputNSpinner(int ID, string flags$, string mask$, string rules$, int restore, int value, int min, int max) |
|
addInputNSpinner() |
|
addInputNSpinner(int min, int max) |
|
addInputNSpinner(string flags$) |
|
addInputNSpinner(string flags$, int min, int max) |
|
addInputNSpinner(string flags$, string mask$) |
|
addInputNSpinner(string flags$, string mask$, int min, int max) |
|
addInputNSpinner(string flags$, string mask$, string rules$) |
|
addInputNSpinner(string flags$, string mask$, string rules$, int restore, int value) |
|
addInputNSpinner(string flags$, string mask$, string rules$, int restore, int value, int min, int max) |
Parameters
Variable |
Description |
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ID |
INPUTN control ID. |
||||||||||||||||
x |
Horizontal position of the upper-left corner of the INPUTN control. |
||||||||||||||||
y |
Vertical position of the upper-left corner of the INPUTN control. |
||||||||||||||||
w |
Width of the INPUTN control. |
||||||||||||||||
h |
Height of the INPUTN control. To create a standard size control, set the h parameter to 0. |
||||||||||||||||
flags$ |
Control flags, as follows:
|
||||||||||||||||
mask$ |
Output mask. If the "0" mask is used and SETOPTS byte 2, bit $80$ is set, it will not be possible to insert values. Either disable the SETOPTS bit or use the "#" mask. |
||||||||||||||||
rules$ |
Input rules. If null, the value in STBL("!IRULES") is used as a default. The mask$ is used to generated the edit mask, which uses "#", "0", and "." mask characters.
|
||||||||||||||||
restore |
Restore value. |
||||||||||||||||
val |
Default value. |
||||||||||||||||
min |
The minimum value to which the spinner may spin |
||||||||||||||||
max |
The maximum value to which the spinner may spin |
Return Value
Returns the created object.
Remarks
A BBjInputNSpinner adds spinner functionality to a standard BBjInputN control.
If the ID parameter is not specified, a control ID is assigned dynamically using getAvailableControlID().
If the x, y, width, and height parameters are not specified, they're all initialized to 0. This is typically for use with DWC windows that dynamically arrange their contents (window creation flag $00100000$).
Example
BBjInputNSpinner Example
USE java.util.HashMap
REM Obtain the instance of the BBjAPI object
LET myAPI!=BBjAPI()
REM Open the SysGui device
SYSGUI=UNT
OPEN (SYSGUI)"X0"
REM Obtain the instance of the BBjSysGui object
LET mySysGui!=myAPI!.getSysGui()
REM Set addWindow param values
X=200
Y=200
WIDTH=350
HEIGHT=250
TITLE$="Event Simulation"
REM Set the current context
mySysGui!.setContext(0)
REM Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$,$00010083$)
REM Create fields for time
myHourSpinner! = myWindow!.addInputNSpinner(101, 10, 10, 35, 25, $$, "##", $$, 1, 1)
testInputN! = myWindow!.addInputN(201, 190, 10, 35, 25, $$, "##", $$, 1, 1)
testInputN!.setCallback(myAPI!.ON_EDIT_MODIFY, "ED_MOD")
myHourSpinner!.setCallback(myAPI!.ON_EDIT_MODIFY, "ED_MOD")
min! = myHourSpinner!.getMinimum()
IF (min! = NULL() OR min! <> 1)
myHourSpinner!.setMinimum(1)
ENDIF
max! = myHourSpinner!.getMaximum()
IF (max! = NULL() OR max! <> 12)
myHourSpinner!.setMaximum(12)
ENDIF
myMinuteSpinner! = myWindow!.addInputNSpinner(102, 55, 10, 35, 25, $$, "00")
origColor! = myMinuteSpinner!.getBackColor()
min! = myMinuteSpinner!.getMinimum()
IF (min! = NULL() OR min! <> 0)
myMinuteSpinner!.setMinimum(0)
ENDIF
max! = myMinuteSpinner!.getMinimum()
IF (max! = NULL() OR max! <> 55)
myMinuteSpinner!.setMaximum(55)
ENDIF
IF (myMinuteSpinner!.getStepSize() <> 5)
myMinuteSpinner!.setStepSize(5)
ENDIF
myHalfVec! = myAPI!.makeVector()
myHalfVec!.add("AM")
myHalfVec!.add("PM")
myHalfSpinner! = myWindow!.addInputESpinner(103, 100, 10, 35, 25, myHalfVec!)
myHalfSpinner!.setMask("AA")
myEditBox! = myWindow!.addEditBox(104, 10, 45, 120, 25, $$)
myCEdit! = myWindow!.addCEdit(105, 10, 80, 200, 50, $$)
myCEdit!.setLineWrap(1)
myCEdit!.setIgnoreTabs(0)
myList! = myWindow!.addListBox(106, 10, 140, 140, 100, $$)
REM Create a button for adding new languages
myAddButton! = myWindow!.addButton(107, 230, 80, 110, 25, "Add Event")
REM Create a button for deleting existing languages
myRemoveButton! = myWindow!.addButton(108, 230, 115, 110, 25, "Remove Event")
REM Set callbacks
myWindow!.setCallback(myWindow!.ON_CLOSE,"APP_CLOSE")
myMinuteSpinner!.setCallback(myMinuteSpinner!.ON_SPIN, "MINUTE_SPIN")
myAddButton!.setCallback(myAddButton!.ON_BUTTON_PUSH, "ADD_EVENT")
myRemoveButton!.setCallback(myRemoveButton!.ON_BUTTON_PUSH, "REMOVE_EVENT")
myList!.setCallback(myList!.ON_LIST_DOUBLE_CLICK, "SELECT_EVENT")
myEventTimes! = new HashMap()
myEventDescs! = new HashMap()
PROCESS_EVENTS
REM Callback for myMinuteSpinner! ON_SPIN
MINUTE_SPIN:
next! = myMinuteSpinner!.getNextNumber()
prev! = myMinuteSpinner!.getPreviousNumber()
myMinuteSpinner!.setBackColor(origColor!)
IF (next! = NULL())
myMinuteSpinner!.setBackColor(mySysGui!.makeColor(255, 0, 0))
ENDIF
IF (prev! = NULL())
myMinuteSpinner!.setBackColor(mySysGui!.makeColor(255, 0, 0))
ENDIF
RETURN
REM Callback for myAddButton! ON_BUTTON_PUSH
ADD_EVENT:
eventName$ = myEditBox!.getText()
eventDesc$ = myCEdit!.getText()
hour = myHourSpinner!.getValue()
minute = myMinuteSpinner!.getValue()
half$ = myHalfSpinner!.getText()
myEventTimes!.put(eventName$, STR(hour:"00") + ":" + STR(minute:"00") + " " + half$)
myEventDescs!.put(eventName$, eventDesc$)
myList!.addItem(eventName$)
RETURN
REMOVE_EVENT:
eventName$ = myEditBox!.getText()
list! = myList!.getAllItems()
index = list!.indexOf(eventName$)
IF (index >= 0)
myList!.removeItemAt(index)
ENDIF
myEventTimes!.remove(eventName$)
myEventDescs!.remove(eventName$)
RETURN
SELECT_EVENT:
index = myList!.getSelectedIndex()
eventName$ = myList!.getItemAt(index)
timeStr! = myEventTimes!.get(eventName$)
list! = java.util.Arrays.asList(timeStr!.split("[: ]"))
hour = NUM(list!.get(0))
minute = NUM(list!.get(1))
half$ = list!.get(2)
desc$ = myEventDescs!.get(eventName$)
myEditBox!.setText(eventName$)
myCEdit!.setText(desc$)
myHourSpinner!.setValue(hour)
myMinuteSpinner!.setValue(minute)
myHalfSpinner!.setText(half$)
RETURN
APP_CLOSE:
RELEASE
ED_MOD:
PRINT "Got here"
RETURN
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.