BBjTabCtrl::getImageHeightAt

Description

In BBj 15.00 and higher, this method returns the current height of the image displayed on a tab in the BBjTabCtrl.

Syntax

Return Value

Method

int

getImageHeightAt(int index)

Parameters

Variable

Description

index

Specifies the 0-based index of the tab.

Return Value

Returns the current height of the image on the specified tab.

Example

rem ' getImageHeightAt

precision 16
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
mgr! = sysgui!.getImageManager()
modal = 1; rem msgbox("Modal dialog?",4+32,"Modal") = 6
flags$ = iff(modal,$00090003$,$00010003$)
window! = sysgui!.addWindow(50,50,400,350,"BBjTabControl",flags$)
window!.setCallback(window!.ON_CLOSE,"eoj")
clearImageSizeAt! = window!.addToolButton(101,25,200,350,25,"clearImageSizeAt",$$)
clearImageSizeAt!.setCallback(clearImageSizeAt!.ON_TOOL_BUTTON_PUSH,"clearImageSizeAt")
imageWidth! = window!.addHorizontalSlider(102,25,250,350,50,$$)
imageWidth!.setPaintLabels(1)
imageWidth!.setToolTipText("Image Width")
imageWidth!.setCallback(imageWidth!.ON_CONTROL_SCROLL,"imageWidth")
imageHeight! = window!.addHorizontalSlider(103,25,300,350,50,$$)
imageHeight!.setPaintLabels(1)
imageHeight!.setToolTipText("Image Height")
imageHeight!.setCallback(imageHeight!.ON_CONTROL_SCROLL,"imageHeight")
tabctrl! = window!.addTabCtrl(100,25,25,350,150,$0000$)
tabctrl!.setCallback(tabctrl!.ON_TAB_SELECT,"tabSelect")
tab = 0
width! = bbjapi().makeVector()
height! = bbjapi().makeVector()
while 1
    dread image$,end=*break
    image! = mgr!.loadImageFromServerJar(image$)
    child! = window!.addChildWindow(200+tab,0,25,340,100,"",$00000810$,200+tab,$$)
    text! = child!.addStaticText(300,tab,tab,200,50,image$)
    tabctrl!.addTab(""+str(tab),tab,child!)
    width = image!.getWidth()
    width!.add(width)
    height = image!.getHeight()
    height!.add(height)
    tabctrl!.setToolTipTextAt(tab,"Tab #"+str(tab)+": "+image$+" ("+str(width)+","+str(height)+")")
    max = 10
    if (height > max) then
        scale = max/height
        print tab,width,height,scale,
        width = round(width*scale,2)
        height = round(height* scale,2)
        print width,height
        tabctrl!.setImageSizeAt(tab,width,height)
    endif
    tabctrl!.setImageAt(tab,image!)
    print tabctrl!.getToolTipTextAt(tab)
    tab = tab + 1
wend
tabctrl!.setVisible(0)
tabctrl!.setSelectedIndex(tab-1)
tabctrl!.setVisible(1)
tabctrl!.focus()
tabctrl!.setSelectedIndex(0)

process_events

eoj:
release

tabSelect:
    event! = sysgui!.getLastEvent()
    index = event!.getIndex()
    clearImageSizeAt!.setText("clearImageSizeAt "+str(index))
    gosub update
return

clearImageSizeAt:
    index = tabctrl!.getSelectedIndex()
    if index < 0 then return
    tabctrl!.clearImageSizeAt(index)
    gosub update
return

imageWidth:
    event! = sysgui!.getLastEvent()
    width = event!.getPosition()
    height = imageHeight!.getValue()
    index = tabctrl!.getSelectedIndex()
    print "imageSize",index,width,height
    tabctrl!.setImageSizeAt(index,width,height)
return

imageHeight:
    event! = sysgui!.getLastEvent()
    width = imageWidth!.getValue()
    height = event!.getPosition()
    index = tabctrl!.getSelectedIndex()
    print "imageSize",index,width,height
    tabctrl!.setImageSizeAt(index,width,height)
return

update:
    width = width!.get(index)
    imageWidth!.setPaintTicks(width < 100)
    imageWidth!.setMajorTickSpacing(10^ept(width/10))
    imageWidth!.setMaximum(width)
    imageWidth!.setValue(tabctrl!.getImageWidthAt(index))
    height = height!.get(index)
    imageHeight!.setPaintTicks(height < 100)
    imageHeight!.setMajorTickSpacing(10^ept(height/10))
    imageHeight!.setMaximum(height)
    imageHeight!.setValue(tabctrl!.getImageHeightAt(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/red-ball.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.