BBjNavigator

Description

In BBj 4.0 and higher, the BBjNavigator object provides methods for manipulating a GUI navigator control. The Navigator panel contains four buttons – "|<" (First), "<" (Previous), ">" (Next) and ">|" (Last). Clicking on the buttons fires events that can be handled based on the needs of the application.

Implemented Interfaces

DropTarget, Editable, Focusable, MouseWheelEnabled, RecordSetBindable,SimpleRecordSetBindable,TabTraversable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjNavigator

A BBjNavigator object is created through the following BBjWindow methods:

Return Value

Method

BBjNavigator

addNavigator(int ID, int x, int y, int width, int height, string title)

BBjNavigator

addNavigator(int ID, int x, int y, int width, int height, 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)

Methods of BBjNavigator

Return Value

Method

BBjRecordSet

getTargetRecordSet()

boolean

isEditable()

void

setButtonWidth(int width)

void

setEditable(boolean editable)

ClosedMethods Implemented for Interfaces

Methods of BBjNavigator implemented for DropTarget

Return Value

Method

int

getDropActions()

void

setDropActions(int actions)

BBjVector

getDropTypes()

void

setDropTypes(BBjVector  types)

Methods of BBjNavigator implemented for Editable

Return Value

Method

boolean

isEditable()

void

setEditable(boolean edit)

Methods of BBjNavigator implemented for Focusable

Return Value

Method

boolean

isFocusable()

void

setFocusable(boolean focus)

Methods of BBjNavigator implemented for MouseWheelEnabled

Return Value

Method

int

getScrollWheelBehavior()

void

setScrollWheelBehavior(int trav)

Methods of BBjNavigator implemented for RecordSetBindable

Return Value

Method

void

bindRecordSet(BBjRecordSet recordset!, string fieldname)

string

getBoundFieldName()

Methods of BBjNavigator implemented for SimpleRecordSetBindable

Return Value

Method

BBjRecordSet

getBoundRecordSet()

void

unbindRecordSet()

Methods of BBjNavigator implemented for TabTraversable

Return Value

Method

boolean

isTabTraversable()

void

setTabTraversable(boolean trav)

Methods of BBjNavigator inherited from BBjControl

Return Value

Method

BBjPopupMenu

addPopupMenu()

boolean

addStyle(string styleName)

void

clearCallback(int eventType)

void

clearStyles()

void

destroy()

void

focus()

string

getAttribute(string attribute)

BBjColor

getBackColor()

boolean getBeepOnValidationFailure()

boolean

getCausesControlValidation()

boolean

getClientEdge()

Object

getClientProperty(Object key)

string

getComputedStyle(string property)

int

getContextID()

int

getControlType()

BBjFont

getFont()

BBjColor

getForeColor()

int

getHeight()

int

getID()

string

getLongCue()

string

getName()

boolean

getNoEdge()

BBjWindow

getParentWindow()

BBjPopupMenu

getPopupMenu()

boolean

getRaisedEdge()

int

getScreenX()

int

getScreenY()

string

getShortCue()

string

getStyle(string property)

BBjVector

getStyles()

string

getText()

string

getToolTipText()

Object

getUserData()

int

getWidth()

int

getX()

int

getY()

boolean

isDestroyed()

boolean

isEnabled()

boolean

isGrouped()

boolean

isOpaque()

boolean

isVisible()

void

putClientProperty(Object key, Object value)

void

removePopupMenu()

boolean

removeStyle(string styleName)

void

setAttribute(string attribute,string value)

void

setBackColor(BBjColor color!)

void setBeepOnValidationFailure(boolean shouldBeep)

void

setCallback(int eventType, CustomObject customObj, string methodName)

void

setCallback(int eventType, string subRoutineName)

void

setCausesControlValidation(boolean valid)

void

setClientEdge(boolean client)

void

setCursor(int cursor)

void

setEnabled(boolean enabled)

void

setFont(BBjFont font!)

void

setForeColor(BBjColor color!)

void

setGrouped(boolean grouped)

void

setLocation(int x, int y)

void

setLongCue(string cue)

void

setName(string name)

void

setNoEdge(boolean noEdge)

void

setOpaque(boolean opaque)

void

setPopupMenu(BBjPopupMenu popupMenu!)

void

setRaisedEdge(boolean raised)

void

setShortCue(string cue)

void

setSize(int width, int height)

void

setStyle(string property, string value)

void

setText(string text)

void

setToolTipText(string text)

void

setUserData(Object userData)

void

setVisible(boolean visible)

void

showToolTipText()

showToolTipText(int x, int y)

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_DROP_TARGET_DROP

BBjDropTargetDropEvent

Drop Target Drop Event

D

ON_GAINED_FOCUS

BBjGainedFocusEvent

Control Focus Gained/Lost Event

f

ON_LOST_FOCUS

BBjLostFocusEvent

Control Focus Gained/Lost Event

f

ON_MOUSE_ENTER

BBjMouseEnterEvent

Mouse Enter/Exit Event

E

ON_MOUSE_EXIT

BBjMouseExitEvent

Mouse Enter/Exit Event

E

ON_NAV_FIRST

BBjNavigatorMoveFirstEvent

Navigator Press Button Event

N (Notify code 1)

ON_NAV_LAST

BBjNavigatorMoveLastEvent

Navigator Press Button Event

N (Notify code 4)

ON_NAV_NEXT

BBjNavigatorMoveNextEvent

Navigator Press Button Event

N (Notify code 3)

ON_NAV_PREVIOUS

BBjNavigatorMovePreviousEvent

Navigator Press Button Event

N (Notify code 2)

ON_POPUP_REQUEST

BBjPopupRequestEvent

Popup Request Event

r

ON_RIGHT_MOUSE_DOWN

BBjRightMouseDownEvent

Right Mouse Button Down Event

R

CSS

The visual appearance of BUI controls is defined using CSS (cascading style sheets) rules. Easily change the default colors, border, and other settings by customizing these rules, all without changing any application code. See CSS API for a high-level overview of BUI CSS.

Refer to this very simple BBjNavigator program for reference:

sysgui = unt

open (sysgui)"X0"

sysgui! = bbjapi().getSysGui()

window! = sysgui!.addWindow(100,100,450,150,"Navigator",$00090003$)

window!.setCallback(window!.ON_CLOSE,"eoj")

navigator! = window!.addNavigator(101,50,50,350,50,"Navigator",$0000$)

navigator!.setButtonWidth(50)

process_events

eoj:

release

With the default CSS styles, the BBjNavigator looks like this:

 The BBjNavigator defines the following style names:

.BBjNavigator (The top level style)

.BBjNavigator-first (The "first" button)

.BBjNavigator-previous (The "previous" button)

.BBjNavigator-label (The label in the middle)

.BBjNavigator-next (The "next" button)

.BBjNavigator-last (The "last" button)

.BBjNavigator.bbj-disabled (Navigator is disabled)

.BBjNavigator.bbj-focused (Navigator is focused)

.BBjNavigator.bbj-readonly (Navigator is read-only)

The following CSS applies a green gradient to the Navigator:

Copy

BBjNavigator CSS

.BBjNavigator, .BBjNavigator-first, .BBjNavigator-previous, .BBjNavigator-label, .BBjNavigator-next, .BBjNavigator-last
{
  font-size: 16px !important;
  background: rgb(180,227,145);
  background: -moz-linear-gradient(top,  rgba(180,227,145,1) 0%, rgba(97,196,25,1) 50%, rgba(180,227,145,1) 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(180,227,145,1)), color-stop(50%,rgba(97,196,25,1)), color-stop(100%,rgba(180,227,145,1)));
  background: -webkit-linear-gradient(top,  rgba(180,227,145,1) 0%,rgba(97,196,25,1) 50%,rgba(180,227,145,1) 100%);
  background: -o-linear-gradient(top,  rgba(180,227,145,1) 0%,rgba(97,196,25,1) 50%,rgba(180,227,145,1) 100%);
  background: -ms-linear-gradient(top,  rgba(180,227,145,1) 0%,rgba(97,196,25,1) 50%,rgba(180,227,145,1) 100%);
  background: linear-gradient(to bottom,  rgba(180,227,145,1) 0%,rgba(97,196,25,1) 50%,rgba(180,227,145,1) 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b4e391', endColorstr='#b4e391',GradientType=0 );
}
.BBjNavigator-label
{
  padding: 10px;
}

With those custom CSS styles, the Navigator looks like this:

Remarks

Mobile touch-oriented browsers (e.g. Mobile Safari in iOS, Chrome in Android) wait for 300 milliseconds after the user taps an element before generating a click event. This delay makes applications feel sluggish when the user tries to click on buttons in rapid sequence. When the FAST_TOUCH_CLICK !OPTIONS setting is set to setting is set to , BUI navigators on iOS and Android report ON_NAV_FIRST, ON_NAV_LAST, ON_NAV_NEXT and ON_NAV_PREVIOUS  immediately when the user touches and releases their finger from the corresponding navigator buttons. This improves the responsiveness for those events, but introduces some side effects that the developer should be aware of. Because BUI is handling touch events on these buttons, normal double-tap and pinch-zoom gestures don't work. And because BUI is reporting the ON_NAV_* events immediately, it appears in the event stream before the navigator reports gaining focus. Some applications are sensitive to precise sequence of events.

Constants inherited from BBjControl

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

BBjRecordSet

BBjSysGui

BBjWindow

CALLBACK Verb - Register BBj Subroutine

Focusable

RecordSetBindable

TabTraversable

MouseWheelEnabled

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