BBjListBox::getBackColorAt

Description

In BBj 23.00 and higher, this method returns the background color of a specified BBjListBox index.

Syntax

Return Value

Method

BBjColor

getBackColorAt(int index)

Parameters

Variable

Description

index

Specifies the 0-based index of the listbox item.

Return Value

In BBj 23.00 and higher, this method returns the background color of a specified BBjListBox index.

Remarks

None.

Example

rem ' BBjListBox getBackColorAt

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,600,600,"BBjListBox",$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
listbox! = window!.addListBox(101,25,25,550,550,"",$0000$)
listbox!.setCallback(listbox!.ON_LIST_DOUBLE_CLICK,"click")
font! = sysgui!.makeFont("Arial",16,0)
listbox!.setFont(font!)
mgr! = sysgui!.getImageManager()
debug = 0
w = 128
h = 64
restore 0
i = 0
while 1
    dread image$,end=*break
    listbox!.addItem(image$)
    image! = mgr!.loadImageFromServerJar(image$)
    width = image!.getWidth()
    height = image!.getHeight()
    if debug then print image$,image!.getWidth(),image!.getHeight()
    if (width>w or height>h) then
        if debug then print "Image width",width," height",height
    else
        listbox!.setImageAt(i, image!)
    endif
    i = i + 1
    listbox!.addItem(str(i)+" "+fill(32,"*"))
    i = i + 1
wend
for i = 0 to 25
    listbox!.addItem(fill(32,"X")+" "+chr(asc("A")+i))
next i
count = listbox!.getItemCount()
for i = 0 to count-1
    if (mod(i,2)) then
        r = 128+rnd(128), g = 128+rnd(128), b = 128+rnd(128)
        color! = bbjapi().makeColor(r,g,b)
        if debug then print " background ",color!,i
        listbox!.setBackColorAt(i,color!)
    endif
    if (mod(i,4)=2) then
        r = rnd(128), g = rnd(128), b = rnd(128)
        color! = bbjapi().makeColor(r,g,b)
        if debug then print " foreground ",color!,i
        listbox!.setForeColorAt(i,color!)
    endif
next i

process_events

eoj:
release

resize:
    event! = sysgui!.getLastEvent()
    width = event!.getWidth()
    height = event!.getHeight()
    listbox!.setSize(width-50,height-50)
return

click:
    event! = sysgui!.getLastEvent()
    index = event!.getSelectedIndex()
    item$ = event!.getSelectedItem()
    if (index>=0) then
        backColor! = listbox!.getBackColorAt(index)
        foreColor! = listbox!.getForeColorAt(index)
    else
        backColor! = listbox!.getBackColor()
        foreColor! = listbox!.getForeColor()
    endif
    color$ = "getBackColor="+str(backColor!) + $0a$ + "getForeColor="+str(foreColor!)
    i = msgbox(color$,0,item$+" ("+str(index)+")")
return

data "com/basis/bbj/images/splash.jpg"
data "com/basis/bbj/images/BBjIDE.gif"
data "com/basis/bbj/images/bbjclient.gif"
data "com/basis/bbj/images/bbjserver.gif"
data "com/basis/bbj/images/broken.png"
data "com/basis/bbj/images/browser.gif"
data "com/basis/bbj/images/busyrow.gif"
data "com/basis/bbj/images/close.gif"
data "com/basis/bbj/images/copy.gif"
data "com/basis/bbj/images/cuidemo.gif"
data "com/basis/bbj/images/cursor_c_1616.gif"
data "com/basis/bbj/images/cursor_c_3232.gif"
data "com/basis/bbj/images/cut.gif"
data "com/basis/bbj/images/datadmin.gif"
data "com/basis/bbj/images/deleterow.gif"
data "com/basis/bbj/images/demoicons.gif"
data "com/basis/bbj/images/fieldtest.jpg"
data "com/basis/bbj/images/first.gif"
data "com/basis/bbj/images/fitheight.gif"
data "com/basis/bbj/images/fitwidth.gif"
data "com/basis/bbj/images/griddemo.gif"
data "com/basis/bbj/images/guicontrols.gif"
data "com/basis/bbj/images/helpbook.gif"
data "com/basis/bbj/images/insertrow.gif"
data "com/basis/bbj/images/jdbcdemo.gif"
data "com/basis/bbj/images/last.gif"
data "com/basis/bbj/images/leftarrow.gif"
data "com/basis/bbj/images/new.gif"
data "com/basis/bbj/images/next.gif"
data "com/basis/bbj/images/no-breakpoint.gif"
data "com/basis/bbj/images/open.gif"
data "com/basis/bbj/images/pagedown.gif"
data "com/basis/bbj/images/pageup.gif"
data "com/basis/bbj/images/paste.gif"
data "com/basis/bbj/images/prev.gif"
data "com/basis/bbj/images/print.gif"
data "com/basis/bbj/images/resconverter.gif"
data "com/basis/bbj/images/rightarrow.gif"
data "com/basis/bbj/images/save.gif"
data "com/basis/bbj/images/selBord.gif"
data "com/basis/bbj/images/sidebyside.gif"
data "com/basis/bbj/images/sqldemo.gif"

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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