BBjListBox

Description

The BBjListBox object provides methods for manipulating a GUI listbox control.

Implemented Interfaces

DragSource, DropTarget, Editable, Focusable, MouseWheelEnabled, RecordSetBindable,RecordSetFillable,Scrollable, SimpleRecordSetBindable,TabTraversable, TextAlignable,Validateable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjListBox

A BBjListBox object is created through the following BBjWindow methods:

Return Value

Method

BBjListBox

addListBox(int ID, number x, number y, number width, number height, string initialContents)

BBjListBox

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

BBjListBox

addListBox(int ID, string initialContents)

BBjListBox

addListBox(int ID, string initialContents, string flags)

BBjListBox

addListBox(string initialContents)

BBjListBox

addListBox(string initialContents, string flags)

Methods of BBjListBox

Return Value

Method

void

addItem(string item)

void

deselectAll()

void

deselectIndex(int index)

BBjVector

getAllItems()

BBjColor getBackColorAt(int index)
BBjColor getForeColorAt(int index)

string

getItemAt(int index)

int

getItemCount()

boolean

getMultipleSelection()

int

getSelectedIndex()

BBjVector

getSelectedIndices()

BBjVector getSelectedItems()

void

insertItemAt(int index, string item)

void

insertItems(int index, BBjVector itemVector!)

void

insertItems(int index, string items$)

boolean

isEditable()

void

removeAllItems()

void

removeItemAt(int index)

void

selectIndex(int index)

void setBackColorAt(int index, BBjColor color)

void

setEditable(boolean edit)

void setForeColorAt(int index, BBjColor color)

void

setImageAt(int index, BBjImage image!)

void

setMultipleSelection(int multi)

void

setSelectedIndices(BBjVector itemVector!)

void

setTextAt(int index, string text)

Methods of BBjListBox implemented for DragSource

Return Value Method
int getDragActions()
string getDragType()
void setDragActions(int actions)
void setDragType(string type)

Methods of BBjListBox implemented for DropTarget

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

Methods of BBjListBox implemented for Editable

Return Value Method
boolean isEditable()
void setEditable(boolean edit)

Methods of BBjListBox implemented for Focusable

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

Methods of BBjListBox implemented for MouseWheelEnabled

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

Methods of BBjListBox implemented for RecordSetBindable

Return Value Method
void bindRecordSet(BBjRecordSet recordset!, string fieldname)
string getBoundFieldName()

Methods of BBjListBox implemented for RecordSetFillable

Return Value Method
void fillFromRecordSet(BBjRecordSet recordset, string fieldname)

Methods of BBjListBox implemented for Scrollable

Return Value Method
int getHorizontalScrollBarHeight()
int getHorizontalScrollBarPosition()
int getHorizontalScrollBarWidth()
int getVerticalScrollBarHeight()
int getVerticalScrollBarPosition()
int getVerticalScrollBarWidth()
boolean isHorizontalScrollBarVisible()
boolean isVerticalScrollBarVisible()
void setHorizontalScrollBarPosition(int position)
void setVerticalScrollBarPosition(int position)

Methods of BBjListBox implemented for SimpleRecordSetBindable

Return Value Method
BBjRecordSet getBoundRecordSet()
void unbindRecordSet()

Methods of BBjListBox implemented for TabTraversable

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

Methods of BBjListBox implemented for TextAlignable

Return Value Method
int getAlignment()
void setAlignment(int align)

Methods of BBjListBox implemented for Validateable

Return Value Method
void accept(boolean valid)
string getValidationText()

Methods of BBjListBox inherited from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_CONTROL_SCROLL

BBjControlScrollEvent

Scrollbar Move Event

p

ON_CONTROL_VALIDATION

BBjControlValidationEvent

Control Validation Event

v

ON_DROP_TARGET_DROP

BBjDropTargetDropEvent

Drop Target Drop Event

D

ON_GAINED_FOCUS

BBjGainedFocusEvent

Control Focus Gained/Lost Event

f

ON_LIST_CLICK

BBjListClickEvent

List Item Click Event

l (lower case L)

ON_LIST_DOUBLE_CLICK

BBjListDoubleClickEvent

List Item Click Event

l (lower case L)

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 BBjListBox defines the following style names:

.BBjListBox (the top level control)

.BBjListBox-item (an individual item within the list)

.BBjListBox-item.bbj-selected (a selected item)

.BBjListBox.bbj-disabled (the control is disabled)

.BBjListBox.bbj-focused (the control is focused)

.BBjListBox.bbj-readonly (the control is read only)

This section uses the list sample from the BBj BUI Showcase (code, demo).

With the default styles, the BBjListBox looks like this:

With the styles shown below, it looks like this:


.BBjListBox
{
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    overflow-x: hidden !important;
    background: #f2f5f6 !important; /* Old browsers */
    background: -moz-linear-gradient(top, #f2f5f6 0%, #e3eaed 37%, #c8d7dc 100%) !important; /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f2f5f6), color-stop(37%,#e3eaed), color-stop(100%,#c8d7dc)) !important; /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #f2f5f6 0%,#e3eaed 37%,#c8d7dc 100%) !important; /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #f2f5f6 0%,#e3eaed 37%,#c8d7dc 100%) !important; /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #f2f5f6 0%,#e3eaed 37%,#c8d7dc 100%) !important; /* IE10+ */
    background: linear-gradient(to bottom, #f2f5f6 0%,#e3eaed 37%,#c8d7dc 100%) !important; /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f5f6', endColorstr='#c8d7dc',GradientType=0 ) !important; /* IE6-9 */
}
.BBjListBox-item
{
}
.BBjListBox-item:hover
{
    font-size: 24px;
    color: white !important;
    background: #1e5799 !important; /* Old browsers */
    background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%) !important; /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8)) !important; /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%) !important; /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%) !important; /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%) !important; /* IE10+ */
    background: linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%) !important; /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ) !important; /* IE6-9 */
}

Remarks

None.

Constants inherited from BBjControl

Example

rem 'Add a list box control to a window

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 = 10
Y = 10
WIDTH = 200
HEIGHT = 200
TITLE$ = "BBj Window"

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

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

rem 'Add a list box control to the window
myListBox! = myWindow!.addListBox(101,50,100,90,60,"",$0000$)

rem 'Add items into the list box
for I = 1 TO 4
    ITEM$="ITEM " + STR(I)
    myListBox!.addItem(ITEM$)
next I

rem 'Register the CALLBACK routines
CALLBACK(ON_LIST_DOUBLE_CLICK,LIST_DOUBLE_CLICKED,mySysGui!.getContext(),myListBox!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

rem 'Process Events
process_events

rem 'Callback routine called when the user double clicks on an item in the list box
LIST_DOUBLE_CLICKED:
    rem 'Display a message with the select list box item
    MESSAGE$="The item selected is: " + STR(myListBox!.getItemAt(myListBox!.getSelectedIndex()))
    let X = MSGBOX(MESSAGE$)
return

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

See Also

BBjAPI

BBjSysGui

BBjWindow

LISTBOX Mnemonic - Create a List Box Control

CALLBACK Verb - Register BBj Subroutine

DWC Component: dwc-listbox

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