BBjNavigator::setEditable

Description

In BBj 4.0 and higher, this method specifies whether the user can activate any of the buttons on the BBjNavigator.

Syntax

Return Value

Method

void

setEditable(boolean editable)

Parameters

Variable

Description

editable

Specifies whether a navigator is editable.

0 = Not editable

1 = Editable

Return Value

None.

Remarks

The navigator is editable by default; the user can activate any of the buttons.

Example

rem 'Set the Navigator to non-editable

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 = 500
HEIGHT = 500
TITLE$="BBjNavigator Sample"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create work file and RecordSet
file$="BBjNavigator.dat"
GOSUB MAKE_FILE
RecordSet! = myAPI!.createFileRecordSet(file$,$$,template$)

rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

myWindow!.addStaticText(800,10,50,100,25,"Static Text: id")
myWindow!.addStaticText(801,10,100,100,25,"Static Text: num")
myWindow!.addStaticText(802,10,150,100,25,"CheckBox: num")
myWindow!.addStaticText(803,10,200,100,25,"CEdit: name")
myWindow!.addStaticText(804,10,250,100,25,"InputE: name")
myWindow!.addStaticText(805,10,300,100,25,"InputN: num")
myWindow!.addStaticText(806,10,350,100,25,"InputD: date")
myWindow!.addStaticText(807,300,50,100,25,"ListButton: name")
myWindow!.addStaticText(808,300,150,100,25,"ListEdit: name")
myWindow!.addStaticText(809,300,250,100,25,"ListBox: num")

stat! = myWindow!.addStaticText(102,150,50,40,25,"text")
stat!.bindRecordSet(RecordSet!,"id")

num! = myWindow!.addStaticText(103,150,100,40,25,"num")
num!.bindRecordSet(RecordSet!,"num")

checkbox! = myWindow!.addCheckBox(104,150,150,80,25,"num:")
checkbox!.bindRecordSet(RecordSet!,"num")

cedit! = myWindow!.addCEdit(105,150,200,80,20,"")
cedit!.bindRecordSet(RecordSet!,"name")

inpute! = myWindow!.addInputE(106,150,250,80,20,"")
inpute!.bindRecordSet(RecordSet!,"name")

inputn! = myWindow!.addInputN(107,150,300,80,20,"")
inputn!.bindRecordSet(RecordSet!,"num")

inputd! = myWindow!.addInputD(108,150,350,80,20,"")
inputd!.bindRecordSet(RecordSet!,"julian")

listbu! = myWindow!.addListButton(109,400,50,80,80,"")
listbu!.bindRecordSet(RecordSet!,"name")
listbu!.fillFromRecordSet(RecordSet!,"name")

listed! = myWindow!.addListEdit(110,400,150,80,80,"")
listed!.fillFromRecordSet(RecordSet!,"name")
listed!.bindRecordSet(RecordSet!,"name")

listbox! = myWindow!.addListBox(111,400,250,80,80,"")
listbox!.fillFromRecordSet(RecordSet!,"num")
listbox!.bindRecordSet(RecordSet!,"num")

myNavigator! = myWindow!.addNavigator(201,10,400,250,30,"NAV")
myNavigator!.setCallback(myNavigator!.ON_NAV_FIRST,"firstRecord")
myNavigator!.setCallback(myNavigator!.ON_NAV_PREVIOUS,"previousRecord")
myNavigator!.setCallback(myNavigator!.ON_NAV_NEXT,"nextRecord")
myNavigator!.setCallback(myNavigator!.ON_NAV_LAST,"lastRecord")

rem ' Make the navigator non-editable
myNavigator!.setEditable(0)
EDITABLE = myNavigator!.isEditable()

rem ' TargetRecordSet is only useful with Navigators from resource files.
print "Navigator RecordSet =",myNavigator!.getTargetRecordSet(err=*next)

save! = myWindow!.addButton(114,280,400,80,25,"Save")
save!.setCallback(save!.ON_BUTTON_PUSH,"doSave")

quit! = myWindow!.addButton(116,380,400,80,25,"Close")
quit!.setCallback(quit!.ON_BUTTON_PUSH,"APP_CLOSE")

myWindow!.setCallback(myWindow!.ON_CLOSE,"APP_CLOSE")

process_events

firstRecord:
    print "FIRST"
    RecordSet!.first()
return

previousRecord:
    print "PREV"
    RecordSet!.previous(err=*next)
return

nextRecord:
    print "NEXT"
    RecordSet!.next(err=*next)
return

lastRecord:
    print "LAST"
    RecordSet!.last()
return

doSave:
    if (RecordSet!.isDirty()) then
        rd! = RecordSet!.getRecordData()
        RecordSet!.saveRecordData(rd!)
        print 'rb',"Save"
    endif
return

APP_CLOSE:
release

MAKE_FILE:
    template$ = "id:n(6),num:n(6),Julian:U(4):DATE = Julian:,name:c(1*)"
    erase file$,err=*next
    mkeyed file$,[1:6],0,40
    chan = unt
    open(chan)file$

    dim r$:template$,names$[11]
    names$[0] = "zero"
    names$[1] = "one"
    names$[2] = "two"
    names$[3] = "three"
    names$[4] = "four"
    names$[5] = "five"
    names$[6] = "six"
    names$[7] = "seven"
    names$[8] = "eight"
    names$[9] = "nine"
    names$[10] = "ten"

    today = JUL(0,0,0)
    for i = 0 to 10
        r.num = i
        r.id = i
        r.JULIAN = today + i
        r.name$ = names$[i]
        write record(chan)r$
    next i
return

See Also

BBjAPI

BBjNavigator

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