BBjWindow::addNavigator

Description

In BBj 4.00 and higher, this method creates a BBjNavigator in the BBjWindow.

Syntax

Return Value

Method

BBjNavigator

addNavigator(int ID, number x, number y, number w, number h, string title)

BBjNavigator

addNavigator(int ID, number x, number y, number w, number h, string title, string flags)

BBjNavigator

addNavigator(int ID, string title)

BBjNavigator

addNavigator(int ID, string title, string flags)

BBjNavigator

addNavigator(string title)

BBjNavigator

addNavigator(string title, string flags)

Parameters

Variable

Description

ID

Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window.

x

Horizontal position of the upper-left corner of the control in current units.

y

Vertical position of the upper-left corner of the control in current units.

width

Width of the control in current units.

height

Height of the control in current units.

title

Title of the control. Including the '&' before a character in the title causes it to be an accelerator.

flags

Control flags, as follows:

Flag Description
$0001$ Sets the control to be initially disabled.
$0010$ Sets the control to be initially invisible.
$0800$ Draws a recessed client edge around the control.
$1000$ Draws a raised edge around the control.

Return Value

Returns the created BBjNavigator object.

Remarks

A Navigator control provides a convenient way to navigate within a BBjRecordSet.

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 'Data-bound controls with a Standard Navigator

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 ' Create the data file
FILENAME$="State.dat"
MODES$=""
TEMPLATE$="STATE:C(2),NAME:C(16*=0)"
erase FILENAME$,err=*next
mkeyed FILENAME$,[0:1:2],0,32
channel=unt
open (channel)FILENAME$
dim REC$:TEMPLATE$

rem ' Load the file with state codes and names
while 1
    dread rec.state$,rec.name$,END=*break
    write record (channel)rec$
wend
close (channel)

rem ' Create the RecordSet
RecordSet! = BBJAPI().createFileRecordSet(FILENAME$,MODES$,TEMPLATE$)

rem 'Set addWindow param values
X=200
Y=200
WIDTH=350
HEIGHT=220
TITLE$="Data-bound controls sample"

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

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

myWindow!.addStaticText(101,50,50,100,25,"State:")
state! = myWindow!.addEditBox(201,100,50,40,25,"")
state!.setEditable(0)
state!.bindRecordSet(RecordSet!,"state")

myWindow!.addStaticText(102,50,100,100,25,"Name:")
name! = myWindow!.addEditBox(202,100,100,200,25,"")
name!.bindRecordSet(RecordSet!,"name")

Navigator! = myWindow!.addNavigator(100,50,150,250,30,"Navigator")
Navigator!.bindRecordSet(RecordSet!,"state")

Navigator!.setCallback(Navigator!.ON_NAV_FIRST,"first")
Navigator!.setCallback(Navigator!.ON_NAV_PREVIOUS,"previous")
Navigator!.setCallback(Navigator!.ON_NAV_NEXT,"next")
Navigator!.setCallback(Navigator!.ON_NAV_LAST,"last")

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

process_events

first:
    gosub save
    RecordSet!.first()
return

previous:
    gosub save
    RecordSet!.previous(err=*next)
return

next:
    gosub save
    RecordSet!.next(err=*next)
return

last:
    gosub save
    RecordSet!.last()
return

save:
    if (RecordSet!.isCurrentRecordDirty()) then
        print 'rb',
        RecordSet!.update(RecordSet!.getCurrentRecordData())
    endif
return

APP_CLOSE:
release

DATA "AK","Alaska"
DATA "AL","Alabama"
DATA "AR","Arkansas"
DATA "AZ","Arizona"
DATA "CA","California"
DATA "CO","Colorado"
DATA "CT","Connecticut"
DATA "DC","District of Columbia"
DATA "DE","Delaware"
DATA "FL","Florida"
DATA "GA","Georgia"
DATA "GU","Guam"
DATA "HI","Hawaii"
DATA "IA","Iowa"
DATA "ID","Idaho"
DATA "IL","Illinois"
DATA "IN","Indiana"
DATA "KS","Kansas"
DATA "KY","Kentucky"
DATA "LA","Louisiana"
DATA "MA","Massachusetts"
DATA "MD","Maryland"
DATA "ME","Maine"
DATA "MI","Michigan"
DATA "MN","Minnesota"
DATA "MO","Missouri"
DATA "MS","Mississippi"
DATA "MT","Montana"
DATA "NC","North Carolina"
DATA "ND","North Dakota"
DATA "NE","Nebraska"
DATA "NH","New Hampshire"
DATA "NJ","New Jersey"
DATA "NM","New Mexico"
DATA "NV","Nevada"
DATA "NY","New York"
DATA "OH","Ohio"
DATA "OK","Oklahoma"
DATA "OR","Oregon"
DATA "PA","Pennsylvania"
DATA "PR","Puerto Rico"
DATA "RI","Rhode Island"
DATA "SC","South Carolina"
DATA "SD","South Dakota"
DATA "TN","Tennessee"
DATA "TX","Texas"
DATA "UT","Utah"
DATA "VA","Virginia"
DATA "VI","Virgin Islands"
DATA "VT","Vermont"
DATA "WA","Washington"
DATA "WI","Wisconsin"
DATA "WV","West Virginia"
DATA "WY","Wyoming"

end

See Also

BBjAPI

BBjSysGui

BBjControl

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