BBjTree::getSelectedBackColor

Description

In BBj 18.00 and higher, this method gets the background color of selected BBjTree nodes.

Syntax

Return Value Method
BBjColor getSelectedBackColor()

Parameters

None.

Return Value

None.

Example

rem ' Set tree selection colors

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
pos = iff(info(3,6)="5",10,100)
title$ = "Tree Selection Colors"
window! = sysgui!.addWindow(pos,pos,300,450,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
im! = sysgui!.getImageManager()
basis$ = "com/basis/bbj/images/basis-b.gif"
basis! = im!.loadImageFromServerJar(basis$)
image$ = "com/basis/bbj/images/red-ball.gif"
image! = im!.loadImageFromServerJar(image$)
next$ = "com/basis/bbj/images/NavigatorNext.gif"
next! = im!.loadImageFromServerJar(next$)
prev$ = "com/basis/bbj/images/NavigatorPrevious.gif"
prev! = im!.loadImageFromServerJar(prev$)

rem ' Define tree data
dim music$[2,4]
music$[0,0]="The Beatles"
music$[0,1]="Hey Jude"
music$[0,2]="Let It Be"
music$[0,3]="Twist and Shout"
music$[0,4]="Yesterday"
music$[1,0]="Paul Simon"
music$[1,1]="Bridge Over Troubled Water"
music$[1,2]="Hearts and Bones"
music$[1,3]="Kathy's Song"
music$[1,4]="The Sound of Silence"
music$[2,0]="Willie Nelson"
music$[2,1]="Always On My Mind"
music$[2,2]="Getting Over You"
music$[2,3]="Old Fords and Natural Stone"
music$[2,4]="This Morning"
dim image$[2,4]

rem ' fill in filenames here to set node-specific icons
image$[0,0]=""; rem "The Beatles"
image$[0,1]=""; rem "Hey Jude"
image$[0,2]=""; rem "Let It Be"
image$[0,3]=""; rem "Twist and Shout"
image$[0,4]=""; rem "Yesterday"
image$[1,0]=""; rem "Paul Simon"
image$[1,1]=""; rem "Bridge Over Troubled Water"
image$[1,2]=""; rem "Hearts and Bones"
image$[1,3]=""; rem "Kathy's Song"
image$[1,4]=""; rem "The Sound of Silence"
image$[2,0]=""; rem "Willie Nelson"
image$[2,1]=""; rem "Always On My Mind"
image$[2,2]=""; rem "Getting Over You"
image$[2,3]=""; rem "Old Fords and Natural Stone"
image$[2,4]=""; rem "This Morning"

rem ' Create and populate tree
tree! = window!.addTree(101,25,25,250,400)
tree!.setTreeEditable(1)
root = 0
root$ = "Musical Tree"
root$ = "<html><h2>" + root$ + "</h2></html>"
tree!.setRoot(root,root$)
tree!.setNodeIcon(root_id, basis!)
tree!.setLeafIcon(image!)
tree!.setCollapsedIcon(prev!)
tree!.setExpandedIcon(next!)
tree!.setToolTipText(root,root$)
color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
tree!.setNodeForeColor(root,color!)
for artist = 0 to 2
    node = node + 1
    artist$ = "<html><h3>"+music$[artist,0]+"</h3></html>"
    tree!.addExpandableNode(node,root,artist$)
    tree!.setToolTipText(node,artist$)
    color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
    tree!.setNodeForeColor(node,color!)
    if (len(image$[artist,0])) then
        tree!.setNodeIcon(node,image$[artist,0])
    endif
    parent = node
    for song = 1 to 4
        node = node + 1
        song$ = music$[artist,song]
        tree!.addNode(node,parent,song$)
        tree!.setToolTipText(node,song$)
        color! = sysgui!.makeColor(rnd(255),rnd(255),rnd(255))
        tree!.setNodeForeColor(node,color!)
        if (len(image$[artist,song])) then
            tree!.setNodeIcon(node,image$[artist,song])
        endif
    next song
next artist
tree!.setSelectedBackColor(BBjColor.GREEN)
print "getSelectedBackColor: ",tree!.getSelectedBackColor()
tree!.setSelectedForeColor(BBjColor.BLUE)
print "getSelectedForeColor: ",tree!.getSelectedForeColor()
tree!.expandTreeFromNode(0)
tree!.setCallback(tree!.ON_TREE_SELECT,"event")
tree!.setCallback(tree!.ON_TREE_DESELECT,"event")
tree!.setCallback(tree!.ON_TREE_EXPAND,"event")
tree!.setCallback(tree!.ON_TREE_COLLAPSE,"event")
tree!.setCallback(tree!.ON_TREE_EDIT_STOP,"event")
tree!.setCallback(tree!.ON_TREE_MOUSE_UP,"event")
tree!.setCallback(tree!.ON_TREE_MOUSE_DOWN,"event")
tree!.setCallback(tree!.ON_TREE_DOUBLE_CLICK,"event")
tree!.setCallback(tree!.ON_TREE_RIGHT_MOUSE_UP,"event")
tree!.setCallback(tree!.ON_TREE_RIGHT_MOUSE_DOWN,"event")
event = 0
process_events

eoj:
release

event:
    event = event + 1
    dim event$:tmpl(sysgui),generic$:noticetpl(0,0)
    event$ = sysgui!.getLastEventString()
    generic$ = notice(sysgui,event.x)
    dim notice$:noticetpl(generic.objtype,event.flags)
    notice$ = generic$
    e$ = sysgui!.getLastEvent().toString()
    e$ = e$(1,pos("@"=e$)-1)
    print e$,event,":",
    fields = pos($0a$ = fattr(notice$,""),1,0)
    dim field$:"name["+str(fields)+"]:c(1*)"
    let field$ = fattr(notice$,"")
    for field = 1 to fields
        name$ = field.name$[field]
        info$ = fattr(notice$,name$,$$)
        print " ",name$,"=",
        if (asc(info$) = 1) then
            print field(notice$,name$),
        else
            print str(nfield(notice$,name$)),
        endif
    next field
    print ""
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjTree::getSelectedForeColor

BBjTree::setSelectedBackColor

BBjTree::setSelectedForeColor

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