BBjButton::setVerticalAlignment

Description

In BBj 12.0 and higher, this method sets the BBjButton's vertical text alignment.

Syntax

Return Value

Method

void

setVerticalAlignment(int alignment)

Parameters

Variable

Description

alignment

TOP

CENTER

BOTTOM

Return Value

None.

Remarks

The default alignment is CENTER.

Example

rem ' BBjButton::setVerticalAlignment

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
imageManager! = sysgui!.getImageManager()
image$ = "com/basis/utilities/launchdock/icons/bbj.png"
image! = sysgui!.getImageManager().loadImageFromServerJar(image$)

rem 'image! = imageManager!.loadImageFromFile("visa.png")
font! = sysgui!.makeFont("Cursive",32,0)
text$ = "BBj"
window! = sysgui!.addWindow(50,50,600,700,"align",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
button! = window!.addButton(101,10,10,300,90,"",$$)
button!.setToolTipText("BBjButton")
menubutton! = window!.addMenuButton(102,10,110,300,90,"",$4000$)
menubutton!.setToolTipText("BBjMenuButton")
menubutton2! = window!.addMenuButton(103,10,210,300,90,"",$4000$)
menubutton2!.setToolTipText("BBjMenuButton+Menu")
dropdownMenu! = sysgui!.addPopupMenu()
dropdownItem1! = dropdownMenu!.addMenuItem(-101,"Dropdown Item 1")
dropdownItem2! = dropdownMenu!.addMenuItem(-102,"Dropdown Item 2")
menubutton2!.setDropdownMenu(dropdownMenu!)
toolbutton! = window!.addToolButton(104,10,310,300,90,"",$$)
toolbutton!.setToolTipText("BBjToolButton")
checkbox! = window!.addCheckBox(105,10,410,300,90,"",$0000$)
checkbox!.setToolTipText("BBjCheckBox")
radiobutton! = window!.addRadioButton(106,10,510,300,90,"",$0000$)
radiobutton!.setToolTipText("BBjRadioButton")
statictext! = window!.addStaticText(107,10,610,300,90,"",$$)
statictext!.setToolTipText("BBjStaticText")
statictext!.setBackColor(BBjColor.YELLOW)
setText! = window!.addButton(200,320,10,70,30,"setText")
setText!.setCallback(setText!.ON_BUTTON_PUSH,"setText")
edit! = window!.addEditBox(201,400,10,190,30,text$,$$)
setImage! = window!.addCheckBox(202,320,50,90,30,"setImage",$$)
setImage!.setCallback(setImage!.ON_CHECK_ON,"setImage")
setImage!.setCallback(setImage!.ON_CHECK_OFF,"clearImage")
setFont! = window!.addCheckBox(204,320,80,90,30,"setFont",$$)
setFont!.setCallback(setFont!.ON_CHECK_ON,"setFont")
setFont!.setCallback(setFont!.ON_CHECK_OFF,"clearFont")
window!.addStaticText(205,320,200,90,20,"Horizontal:",$8000$)
left! = window!.addRadioButton(206,420,190,90,30,"LEFT",$0020$)
left!.setCallback(left!.ON_CHECK_ON,"ALIGN_LEFT")
center! = window!.addRadioButton(207,420,220,90,30,"CENTER",$0024$)
center!.setCallback(center!.ON_CHECK_ON,"ALIGN_CENTER")
right! = window!.addRadioButton(208,420,250,90,30,"RIGHT",$0020$)
right!.setCallback(center!.ON_CHECK_ON,"ALIGN_RIGHT")
horizontal! = window!.addRadioGroup()
horizontal!.add(left!)
horizontal!.add(center!)
horizontal!.add(right!)
window!.addStaticText(209,320,300,90,20,"Vertical:",$8000$)
top! = window!.addRadioButton(210,420,300,90,30,"TOP",$0020$)
top!.setCallback(top!.ON_CHECK_ON,"ALIGN_TOP")
middle! = window!.addRadioButton(211,420,330,90,30,"MIDDLE",$0024$)
middle!.setCallback(middle!.ON_CHECK_ON,"ALIGN_MIDDLE")
bottom! = window!.addRadioButton(212,420,360,90,30,"BOTTOM",$0020$)
bottom!.setCallback(bottom!.ON_CHECK_ON,"ALIGN_BOTTOM")
vertical! = window!.addRadioGroup()
vertical!.add(top!)
vertical!.add(middle!)
vertical!.add(bottom!)
window!.addStaticText(213,320,400,90,20,"Text Horizontal:",$8000$)
text_right! = window!.addRadioButton(214,420,400,90,30,"RIGHT",$0020$)
text_right!.setCallback(text_right!.ON_CHECK_ON,"TEXT_RIGHT")
text_left! = window!.addRadioButton(215,420,430,90,30,"LEFT",$0020$)
text_left!.setCallback(text_left!.ON_CHECK_ON,"TEXT_LEFT")
text_center! = window!.addRadioButton(216,420,460,90,30,"CENTER",$0020$)
text_center!.setCallback(text_center!.ON_CHECK_ON,"TEXT_CENTER")
text_leading! = window!.addRadioButton(217,420,490,90,30,"LEADING",$0024$)
text_leading!.setCallback(text_leading!.ON_CHECK_ON,"TEXT_LEADING")
text_trailing! = window!.addRadioButton(218,420,520,90,30,"TRAILING",$0020$)
text_trailing!.setCallback(text_trailing!.ON_CHECK_ON,"TEXT_TRAILING")
text_horizontal! = window!.addRadioGroup()
text_horizontal!.add(text_right!)
text_horizontal!.add(text_left!)
text_horizontal!.add(text_center!)
text_horizontal!.add(text_leading!)
text_horizontal!.add(text_trailing!)
window!.addStaticText(219,320,550,90,20,"Text Vertical:",$8000$)
text_center! = window!.addRadioButton(220,420,550,90,30,"CENTER",$0024$)
text_center!.setCallback(text_center!.ON_CHECK_ON,"TEXT_CENTER_VERTICAL")
text_top! = window!.addRadioButton(221,420,580,90,30,"TOP",$0020$)
text_top!.setCallback(text_top!.ON_CHECK_ON,"TEXT_TOP")
text_bottom! = window!.addRadioButton(222,420,610,90,30,"BOTTOM",$0020$)
text_bottom!.setCallback(text_bottom!.ON_CHECK_ON,"TEXT_BOTTOM")
text_vertical! = window!.addRadioGroup()
text_vertical!.add(text_center!)
text_vertical!.add(text_top!)
text_vertical!.add(text_bottom!)
process_events

eoj:
release

setText:
    text$ = edit!.getText()
    button!.setText(text$)
    menubutton!.setText(text$)
    menubutton2!.setText(text$)
    toolbutton!.setText(text$)
    checkbox!.setText(text$)
    radiobutton!.setText(text$)
    statictext!.setText(text$)
return

setImage:
    button!.setImage(image!)
    button!.setImageSize(64,64)
    menubutton!.setImage(image!)
    menubutton!.setImageSize(64,64)
    menubutton2!.setImage(image!)
    menubutton2!.setImageSize(64,64)
    toolbutton!.setImage(image!)
    toolbutton!.setImageSize(64,64)
return

clearImage:
    button!.setImage(null())
    menubutton!.setImage(null())
    menubutton2!.setImage(null())
    toolbutton!.setImage(null())
return

align_left:
    button!.setAlignment(button!.ALIGN_LEFT)
    menubutton!.setAlignment(menubutton!.ALIGN_LEFT)
    menubutton2!.setAlignment(menubutton2!.ALIGN_LEFT)
    toolbutton!.setAlignment(toolbutton!.ALIGN_LEFT)
    checkbox!.setAlignment(checkbox!.ALIGN_LEFT)
    radiobutton!.setAlignment(radiobutton!.ALIGN_LEFT)
    statictext!.setAlignment(statictext!.ALIGN_LEFT)
    gosub getAlignment
return

align_center:
    button!.setAlignment(button!.ALIGN_CENTER)
    menubutton!.setAlignment(menubutton!.ALIGN_CENTER)
    menubutton2!.setAlignment(menubutton2!.ALIGN_CENTER)
    toolbutton!.setAlignment(toolbutton!.ALIGN_CENTER)
    checkbox!.setAlignment(checkbox!.ALIGN_CENTER)
    radiobutton!.setAlignment(radiobutton!.ALIGN_CENTER)
    statictext!.setAlignment(statictext!.ALIGN_CENTER)
    gosub getAlignment
return

align_right:
    button!.setAlignment(button!.ALIGN_RIGHT)
    menubutton!.setAlignment(menubutton!.ALIGN_RIGHT)
    menubutton2!.setAlignment(menubutton2!.ALIGN_RIGHT)
    toolbutton!.setAlignment(toolbutton!.ALIGN_RIGHT)
    checkbox!.setAlignment(checkbox!.ALIGN_RIGHT)
    radiobutton!.setAlignment(radiobutton!.ALIGN_RIGHT)
    statictext!.setAlignment(statictext!.ALIGN_RIGHT)
    gosub getAlignment
return

getAlignment:
    print "BBjButton::getAlignment",button!.getAlignment()
    print "BBjMenuButton::getAlignment",menubutton!.getAlignment()
    print "BBjMenuButton::getAlignment",menubutton2!.getAlignment()
    print "BBjToolButton::getAlignment",toolbutton!.getAlignment()
    print "BBjCheckBox::getAlignment",checkbox!.getAlignment()
    print "BBjRadioButton::getAlignment",radiobutton!.getAlignment()
    print "BBjStaticText::getAlignment",statictext!.getAlignment()
return

align_top:
    button!.setVerticalAlignment(button!.TOP)
    menubutton!.setVerticalAlignment(menubutton!.TOP)
    menubutton2!.setVerticalAlignment(menubutton2!.TOP)
    toolbutton!.setVerticalAlignment(toolbutton!.TOP)
    gosub getVerticalAlignment
return

align_middle:
    button!.setVerticalAlignment(button!.CENTER)
    menubutton!.setVerticalAlignment(menubutton!.CENTER)
    menubutton2!.setVerticalAlignment(menubutton2!.CENTER)
    toolbutton!.setVerticalAlignment(toolbutton!.CENTER)
    gosub getVerticalAlignment
return

align_bottom:
    button!.setVerticalAlignment(button!.BOTTOM)
    menubutton!.setVerticalAlignment(menubutton!.BOTTOM)
    menubutton2!.setVerticalAlignment(menubutton2!.BOTTOM)
    toolbutton!.setVerticalAlignment(toolbutton!.BOTTOM)
    gosub getVerticalAlignment
return

getVerticalAlignment:
    print "BBjButton::getVerticalAlignment",button!.getVerticalAlignment()
    print "BBjMenuButton::getVerticalAlignment",menubutton!.getVerticalAlignment()
    print "BBjMenuButton::getVerticalAlignment",menubutton2!.getVerticalAlignment()
    print "BBjToolButton::getVerticalAlignment",toolbutton!.getVerticalAlignment()
return

text_right:
    checkbox!.setHorizontalTextPosition(toolbutton!.RIGHT)
    radiobutton!.setHorizontalTextPosition(toolbutton!.RIGHT)
    toolbutton!.setHorizontalTextPosition(toolbutton!.RIGHT)
    gosub getHorizontalTextPosition
return

text_left:
    checkbox!.setHorizontalTextPosition(toolbutton!.LEFT)
    radiobutton!.setHorizontalTextPosition(toolbutton!.LEFT)
    toolbutton!.setHorizontalTextPosition(toolbutton!.LEFT)
    gosub getHorizontalTextPosition
return

text_center:
    checkbox!.setHorizontalTextPosition(toolbutton!.CENTER)
    radiobutton!.setHorizontalTextPosition(toolbutton!.CENTER)
    toolbutton!.setHorizontalTextPosition(toolbutton!.CENTER)
    gosub getHorizontalTextPosition
return

text_leading:
    checkbox!.setHorizontalTextPosition(toolbutton!.LEADING)
    radiobutton!.setHorizontalTextPosition(toolbutton!.LEADING)
    toolbutton!.setHorizontalTextPosition(toolbutton!.LEADING)
    gosub getHorizontalTextPosition
return

text_trailing:
    checkbox!.setHorizontalTextPosition(toolbutton!.TRAILING)
    radiobutton!.setHorizontalTextPosition(toolbutton!.TRAILING)
    toolbutton!.setHorizontalTextPosition(toolbutton!.TRAILING)
    gosub getHorizontalTextPosition
return

getHorizontalTextPosition:
    print "BBjCheckBox::getHorizontalTextPosition",checkbox!.getHorizontalTextPosition()
    print "BBjRadioButton::getHorizontalTextPosition",radiobutton!.getHorizontalTextPosition()
    print "BBjToolButton::getHorizontalTextPosition",toolbutton!.getHorizontalTextPosition()
return

text_top:
    toolbutton!.setVerticalTextPosition(toolbutton!.TOP)
    print "BBjToolButton::getVerticalTextPosition",toolbutton!.getVerticalTextPosition()
return

text_bottom:
    toolbutton!.setVerticalTextPosition(toolbutton!.BOTTOM)
    print "BBjToolButton::getVerticalTextPosition",toolbutton!.getVerticalTextPosition()
return

text_center_vertical:
    toolbutton!.setVerticalTextPosition(toolbutton!.CENTER)
    print "BBjToolButton::getVerticalTextPosition",toolbutton!.getVerticalTextPosition()
return

setFont:
    button!.setFont(font!)
    menubutton!.setFont(font!)
    menubutton2!.setFont(font!)
    toolbutton!.setFont(font!)
    checkbox!.setFont(font!)
    radiobutton!.setFont(font!)
    statictext!.setFont(font!)
return

clearFont:
    button!.setFont(null())
    menubutton!.setFont(null())
    menubutton2!.setFont(null())
    toolbutton!.setFont(null())
    checkbox!.setFont(null())
    radiobutton!.setFont(null())
    statictext!.setFont(null())
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjButton::getVerticalAlignment

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