BBjTree::setNodeImage

Description

This method sets the image of a node in the BBjTree control.

Syntax

Return Value

Method

void

setNodeImage(int ID, BBjImageimage)

Parameters

Variable

Description

image

Specifies the icon image of the node.

Return Value

None.

Remarks

None.

Example

REM Set node-specific images in a tree control

 

sysgui = unt

open (sysgui)"X0"

sysgui! = bbjapi().getSysGui()

 

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$)

 

window! = sysgui!.addWindow(100,100,300,300,"BBjTree",$00090003$)

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

tree! = window!.addTree(101,0,0,300,300)

 

root_id = 0

tree!.setRoot(root_id,"Musical Tree")

tree!.setNodeImage(root_id, basis!)

rem tree!.setLeafIcon(image!)

rem tree!.setCollapsedIcon(prev!)

rem tree!.setExpandedIcon(next!)

 

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"

 

parent_id = root_id

 

for artist = 0 to 2

  node_id = node_id + 1

  tree!.addExpandableNode(node_id, parent_id, music$[artist,0])

  tree!.setNodeIcon(node_id, image!)

  song_parent_id = node_id

  for song = 1 to 4

    node_id = node_id + 1

    tree!.addNode(node_id, song_parent_id, music$[artist,song])

    tree!.setNodeIcon(node_id, image!)

    if node_id=10 then

      tree!.setNodeIcon(node_id, next!)

      tree!.setNodeSelectedIcon(node_id, prev!)

    endif

  next song

next artist

 

process_events

 

eoj:

release

See Also

BBjAPI

BBjSysGui

BBjControl

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