BBjWindow::addInputNSpinner

Description

In BBj 7.00 and higher, this method creates a BBjInputNSpinner on the BBjWindow.

Syntax

Return Value

Method

BBjInputNSpinner

addInputNSpinner()

BBjInputNSpinner

addInputNSpinner(int ID)

BBjInputNSpinner

addInputNSpinner(int ID, int min, int max)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, int min, int max)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$, float min, float max)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$, string mask$)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$, string mask$, float min, float max)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$, string mask$, string rules$)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$, string mask$, string rules$, float restore, float value)

BBjInputNSpinner

addInputNSpinner(int ID, number x, number y, number w, number h, string flags$, string mask$, string rules$, float restore, float value, float min, float max)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$, int min, int max)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$, string mask$)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$, string mask$, int min, int max)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$, string mask$, string rules$)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$, string mask$, string rules$, int restore, int value)

BBjInputNSpinner

addInputNSpinner(int ID, string flags$, string mask$, string rules$, int restore, int value, int min, int max)

BBjInputNSpinner

addInputNSpinner(int min, int max)

BBjInputNSpinner

addInputNSpinner(string flags$)

BBjInputNSpinner

addInputNSpinner(string flags$, int min, int max)

BBjInputNSpinner

addInputNSpinner(string flags$, string mask$)

BBjInputNSpinner

addInputNSpinner(string flags$, string mask$, int min, int max)

BBjInputNSpinner

addInputNSpinner(string flags$, string mask$, string rules$)

BBjInputNSpinner

addInputNSpinner(string flags$, string mask$, string rules$, int restore, int value)

BBjInputNSpinner

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:

Flag Description
$0001$ Sets the control to be initially disabled.
$0002$ Passes the Enter key to the parent window.
$0004$ Passes the Tab key to the parent window.
$0008$ Prompts non-mouse events on the control to highlight the control text.
$0010$ Sets the control to be initially invisible.
$0020$ Designates the control to be part of a keyboard navigation group.
$0800$ Draws a recessed client edge around the control.

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.

Flag Description

$02$ 

Causes commas and numeric characters to be copied when generating the edit mask from mask$.

$80$

Causes the system to beep upon entry of invalid data.

$04$ 

Accepts the decimal point replacement character for data entry defined by SETOPTS(6,1).

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

rem ' 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

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjInputNSpinner

BBjInputN

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.