Interface Scrollable::getHorizontalScrollBarWidth

Description

In BBj 17.0 and higher, this method returns the width of the horizontal scrollbar for a Scrollable BBjControl.

Syntax

Return Value

Method

int

getHorizontalScrollBarWidth()

Parameters

None.

Return Value

Returns the width of the horizontal scrollbar for a Scrollable BBjControl.

Remarks

None.

Example

rem ' Scrollable
sysgui = unt

title$ = "Scrollable"
window! = sysgui!.addWindow(50,50,250,300,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")

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,200,200)
tree!.putClientProperty("JTree.lineStyle","None")
tree!.setBackColor(window!.getBackColor())
tree!.setSelectionMode(tree!.SINGLE_TREE_SELECTION)
tree!.setCollapsedIcon("collapsed.gif",err=*next)
tree!.setExpandedIcon("expanded.gif",err=*next)
tree!.setLeafIcon("leaf.png",err=*next)
tree!.setSelectedIcon("selected.png",err=*next)
root = 0
node = 0
root$ = "Musical Tree"
root$ = "<html><h2>" + root$ + " " + str(root) + "</h2></html>"
tree!.setRoot(root,root$)
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]+" "+str(node)+"</h3></html>"
  tree!.addExpandableNode(node,root,artist$)
  tree!.expandNode(node)
  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]+" "+str(node)
    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!.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")
tree!.setCallback(tree!.ON_CONTROL_SCROLL,"scroll")
tree!.setCallback(tree!.ON_POPUP_REQUEST,"popup")

scrollable! = window!.addMenuButton(1,25,250,100,25,"Scrollable",$$)
scrollable!.setCallback(scrollable!.ON_BUTTON_PUSH,"scrollable")
reset! = window!.addMenuButton(2,125,250,100,25,"Reset",$$)
reset!.setCallback(reset!.ON_BUTTON_PUSH,"reset")

event = 0

dim event$:tmpl(sysgui),generic$:noticetpl(0,0)

process_events

eoj:
release

scrollable:
  print "Scrollable:"
  info$ = "isHorizontalScrollBarVisible="
  info$ = info$ + Boolean.toString(tree!.isHorizontalScrollBarVisible())
  info$ = info$ + $0a$ + "getHorizontalScrollBarWidth="
  info$ = info$ + str(tree!.getHorizontalScrollBarWidth())
  info$ = info$ + $0a$ + "getHorizontalScrollBarHeight="
  info$ = info$ + str(tree!.getHorizontalScrollBarHeight())
  info$ = info$ + $0a$ + "getHorizontalScrollBarPosition="
  info$ = info$ + str(tree!.getHorizontalScrollBarPosition())
  info$ = info$ + $0a$ + "isVerticalScrollBarVisible="
  info$ = info$ + Boolean.toString(tree!.isVerticalScrollBarVisible())
  info$ = info$ + $0a$ + "getVerticalScrollBarWidth="
  info$ = info$ + str(tree!.getVerticalScrollBarWidth())
  info$ = info$ + $0a$ + "getVerticalScrollBarHeight="
  info$ = info$ + str(tree!.getVerticalScrollBarHeight())
  info$ = info$ + $0a$ + "getVerticalScrollBarPosition="
  info$ = info$ + str(tree!.getVerticalScrollBarPosition())
  print info$
  i = msgbox(info$,0,"Scrollable")
return

reset:
  tree!.setHorizontalScrollBarPosition(0)
  tree!.setVerticalScrollBarPosition(0)
return

event:
  event = event + 1
  event! = sysgui!.getLastEvent()
  event$ = sysgui!.getLastEventString()
  print event!.getEventName(),event,":",
  if event.code$ = "N" then
     generic$ = notice(sysgui,event.x)
     dim notice$:noticetpl(generic.objtype,event.flags)
     notice$ = generic$
     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
  endif
  event! = sysgui!.getLastEvent()
  print ""
  print "Selected node:",tree!.getSelectedNode()
  print ""
return

scroll:
  event = event + 1
  event! = sysgui!.getLastEvent()
  print event!.getEventName(),event,": orientation=",str(event!.getOrientation()),
  print " position=",str(event!.getPosition())," adjusting=",str(event!.isAdjusting())
return

popup:
  event! = sysgui!.getLastEvent()
  event$ = sysgui!.getLastEventString()
  print event!.getEventName()," X=",str(event.x)," Y=",str(event.y)
  print ""
return

resize:
  event! = sysgui!.getLastEvent()
  print "Resized; width=",str(event!.getWidth()),", height=",str(event!.getHeight())
return

See Also

BBjAPI

BBjSysGui

BBjControl

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



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.