BBjScrollBar

Description

The BBjScrollBar object provides methods for manipulating a GUI scroll bar control.

Note: The BBjScrollBar is a standalone BBjControl that should not be confused with scroll bars that can be created with optional flags on windows, child windows, or edit-type controls.

To enable scrolling behavior in a window, horizontal or vertical scrollbars must be enabled and tracking must be turned off. Use the window creation flags $00000004$ (horizontal scrolling) or $00000008$ (vertical scrolling), and set tracking to 0 with window creation flag $80000000$, BBjWindow::setTrack, or the TRACK Mnemonic - Toggle Tracking On/Off (SYSGUI).

Implemented Interfaces

DropTarget, Focusable, MouseWheelEnabled, TabTraversable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjScrollBar

A BBjScrollBar object is created through the following BBjWindow methods:

Return Value

Method

BBjScrollBar

addHorizontalScrollBar()

BBjScrollBar

addHorizontalScrollBar(int ID)

BBjScrollBar

addHorizontalScrollBar(int ID, number x, number y, number width, number height)

BBjScrollBar

addHorizontalScrollBar( int ID, number x, number y, number width, number height, string flags)

BBjScrollBar

addHorizontalScrollBar(int ID, string flags)

BBjScrollBar

addHorizontalScrollBar(string flags)

BBjScrollBar addVerticalScrollBar()
BBjScrollBar addVerticalScrollBar(int ID)
BBjScrollBar addVerticalScrollBar(int ID, number x, number y, number width, number height)
BBjScrollBar addVerticalScrollBar(int ID, number x, number y, number width, number height, string flags)
BBjScrollBar addVerticalScrollBar(int ID, string flags)

BBjScrollBar

addVerticalScrollBar(string flags)

Methods of BBjScrollBar

Return Value

Method

int

getBlockIncrement()

int

getScrollMaximum()

int

getScrollMinimum()

int

getScrollPosition()

int

getScrollProp()

void

setBlockIncrement(int block)

void

setScrollPosition(int pos)

void

setScrollProp(int prop)

void

setScrollRange(int min, int max)

Methods of BBjScrollBar implemented for DropTarget

Return Value Method
int getDropActions()
void setDropActions(int actions)
BBjVector getDropTypes()
void setDropTypes(BBjVector types)

Methods of BBjScrollBar implemented for Focusable

Return Value Method
boolean isFocusable()
void setFocusable(boolean focus)

Methods of BBjScrollBar implemented for MouseWheelEnabled

Return Value Method
int getScrollWheelBehavior()
void setScrollWheelBehavior(int trav)

Methods of BBjScrollBar implemented for TabTraversable

Return Value Method
boolean isTabTraversable()
void setTabTraversable(boolean trav)

Methods of BBjScrollBar inherited from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_CONTROL_SCROLL

BBjControlScrollEvent

Scrollbar Move Event

p

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_POPUP_REQUEST

BBjPopupRequestEvent

Popup Request Event

r

ON_RIGHT_MOUSE_DOWN

BBjRightMouseDownEvent

Right Mouse Button Down Event

R

BUI logoCSS

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.

The BUI BBjScrollBar defines the following style names:

.BBjScrollBar

.BBjScrollBar.bbj-disabled

.BBjScrollBar.bbj-horizontal

.BBjScrollBar.bbj-vertical

.BBjScrollBar.thumb

.BBjScrollBar.horizontal-thumb

.BBjScrollBar-vertical-thumb

.BBjScrollBar-internal

.BBjScrollBar-horizontal-internal

.BBjScrollBar-vertical-internal

.BBjScrollBar-adjusting .BBjScrollBar-thumb

BUI logoRemarks

In BBj 15.00 and higher, BUI implements two different versions of the BBjScrollBar control. The default version is supported on all desktop and touch platforms, and can be styled with custom CSS. An optional version, selected by setting the NATIVE_SCROLLBAR !OPTIONS setting to TRUE, is implemented using a native browser scrollbar. Because of the way touch platforms implement scrolling, this native version is not available in touch-oriented browsers like Mobile Safari on iOS.

Constants inherited from BBjControl

Example

rem ' BBjScrollBar

precision 6
native_scrollbar$="FALSE"
if info(3,6)="5" and msgbox("NATIVE_SCROLLBAR?",4+32+256) = 6 then native_scrollbar$="TRUE"
print stbl("!OPTIONS","NATIVE_SCROLLBAR="+native_scrollbar$)
title$ = "NATIVE_SCROLLBAR="+native_scrollbar$
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,250,250,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
vscroll! = window!.addVerticalScrollBar(101,210,25,20,175,$0000$)
vscroll!.setFocusable(1)
vscroll!.setToolTipText("Vertical ScrollBar")
vscroll!.setName("Vertical ScrollBar")
vscroll!.setText("vscroll")
vscroll!.setCallback(vscroll!.ON_CONTROL_SCROLL,"scroll")
vscroll!.setCallback(vscroll!.ON_GAINED_FOCUS,"event")
vscroll!.setCallback(vscroll!.ON_LOST_FOCUS,"event")
vscroll!.setCallback(vscroll!.ON_MOUSE_ENTER,"event")
vscroll!.setCallback(vscroll!.ON_MOUSE_EXIT,"event")
vscroll!.setCallback(vscroll!.ON_POPUP_REQUEST,"event")
vscroll!.setCallback(vscroll!.ON_RIGHT_MOUSE_DOWN,"event")
vprop! = window!.addInputNSpinner(102,25,25,50,25,0,100)
vprop!.setValue(vscroll!.getScrollProp())
vprop!.setToolTipText("Vertical ScrollBar setScrollProp (thumb size)")
vprop!.setCallback(sysgui!.ON_SPIN,"setVerticalScrollProp")
vpos! = window!.addInputNSpinner(103,85,25,50,25,0,100)
vpos!.setValue(vscroll!.getScrollPosition())
vpos!.setToolTipText("Vertical ScrollBar setScrollPosition (thumb position)")
vpos!.setCallback(sysgui!.ON_SPIN,"setVerticalScrollPosition")
vblock! = window!.addInputNSpinner(104,145,25,50,25,0,100)
vblock!.setValue(vscroll!.getBlockIncrement())
vblock!.setToolTipText("Vertical ScrollBar setBlockIncrement")
vblock!.setCallback(sysgui!.ON_SPIN,"setVerticalBlockIncrement")
hscroll! = window!.addHorizontalScrollBar(105,25,210,200,20,$0000$)
hscroll!.setFocusable(1)
hscroll!.setToolTipText("Horizontal ScrollBar")
hscroll!.setName("Horizontal ScrollBar")
hscroll!.setText("hscroll")
hscroll!.setCallback(hscroll!.ON_CONTROL_SCROLL,"scroll")
hscroll!.setCallback(hscroll!.ON_GAINED_FOCUS,"event")
hscroll!.setCallback(hscroll!.ON_LOST_FOCUS,"event")
hscroll!.setCallback(hscroll!.ON_MOUSE_ENTER,"event")
hscroll!.setCallback(hscroll!.ON_MOUSE_EXIT,"event")
hscroll!.setCallback(hscroll!.ON_POPUP_REQUEST,"event")
hscroll!.setCallback(hscroll!.ON_RIGHT_MOUSE_DOWN,"event")
hprop! = window!.addInputNSpinner(106,25,75,50,25,0,100)
hprop!.setValue(hscroll!.getScrollProp())
hprop!.setToolTipText("Horizontal ScrollBar setScrollProp (thumb size)")
hprop!.setCallback(sysgui!.ON_SPIN,"setHorizontalScrollProp")
hpos! = window!.addInputNSpinner(107,85,75,50,25,0,100)
hpos!.setValue(hscroll!.getScrollPosition())
hpos!.setToolTipText("Horizontal ScrollBar setScrollPosition (thumb position)")
hpos!.setCallback(sysgui!.ON_SPIN,"setHorizontalScrollPosition")
hblock! = window!.addInputNSpinner(108,145,75,50,25,0,100)
hblock!.setValue(hscroll!.getBlockIncrement())
hblock!.setToolTipText("Horizontal ScrollBar setBlockIncrement")
hblock!.setCallback(sysgui!.ON_SPIN,"setHorizontalBlockIncrement")
venable! = window!.addCheckBox(109,25,120,150,25,"Vertical Enabled",$0004$)
venable!.setCallback(venable!.ON_CHECK_ON,"enableVertical")
venable!.setCallback(venable!.ON_CHECK_OFF,"disableVertical")
henable! = window!.addCheckBox(110,25,150,150,25,"Horizontal Enabled",$0004$)
henable!.setCallback(henable!.ON_CHECK_ON,"enableHorizontal")
henable!.setCallback(henable!.ON_CHECK_OFF,"disableHorizontal")
process_events

eoj:
release

scroll:
    event! = sysgui!.getLastEvent()
    control! = event!.getControl()
    print event!.getEventName()," ",
    print control!.getText(),event!.getPosition()," ",event!.isAdjusting(),tim*3600
return

setVerticalScrollProp:
    event! = sysgui!.getLastEvent()
    value$ = event!.getText()
    value = num(value$)
    vscroll!.setScrollProp(value)
return

setHorizontalScrollProp:
    event! = sysgui!.getLastEvent()
    value$ = event!.getText()
    value = num(value$)
    hscroll!.setScrollProp(value)
return

setVerticalScrollPosition:
    event! = sysgui!.getLastEvent()
    value$ = event!.getText()
    value = num(value$)
    vscroll!.setScrollPosition(value)
return

setHorizontalScrollPosition:
    event! = sysgui!.getLastEvent()
    value$ = event!.getText()
    value = num(value$)
    hscroll!.setScrollPosition(value)
return

setVerticalBlockIncrement:
    event! = sysgui!.getLastEvent()
    value$ = event!.getText()
    value = num(value$)
    vscroll!.setBlockIncrement(value)
return

setHorizontalBlockIncrement:
    event! = sysgui!.getLastEvent()
    value$ = event!.getText()
    value = num(value$)
    hscroll!.setBlockIncrement(value)
return

enableHorizontal:
    hscroll!.setEnabled(1)
return

disableHorizontal:
    hscroll!.setEnabled(0)
return

enableVertical:
    vscroll!.setEnabled(1)
return

disableVertical:
    vscroll!.setEnabled(0)
return

event:
    event! = sysgui!.getLastEvent()
    control! = event!.getControl()
    print control!.getName()," ",event!.getEventName()," ",control!,tim*3600
return

See Also

BBjAPI

BBjSysGui

BBjWindow

SCROLL Mnemonic - Set Scrolling Attributes

CALLBACK Verb - Register BBj Subroutine

Focusable

MouseWheelEnabled

TabTraversable

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