Interface TextAlignable::setAlignment


Description

In BBj 7.0 and higher, setAlignment sets the horizontal alignment of the text within the control.

Syntax

Return Value

Method

void

setAlignment(int p_val)

Parameters

Variable

Description

p_val

ALIGN_LEFT – left horizontal alignment

ALIGN_CENTER – center horizontal alignment

ALIGN_RIGHT – right horizontal alignment

Return Value

None.

Example

REM AlignableControl{.setAlignment()|.getAlignment()}
LET myAPI!=BBjAPI()
SYSGUI=UNT
OPEN (SYSGUI) "X0"
LET mySysGui!=myAPI!.getSysGui()
mySysGui!.setContext(0)

myWindow! = mySysGui!.addWindow(10,10,200,200,"Alignment Example")

myButton! = myWindow!.addButton(101,50,100,90,30,"Left Align",$0800$)
myText! = myWindow!.addStaticText(102,50,150,90,30,"Text",$$)
myButton!.setAlignment(myButton!.ALIGN_CENTER)
myText!.setAlignment(myText!.ALIGN_CENTER)


CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
CALLBACK(ON_BUTTON_PUSH,PUSH_BUTT,mySysGui!.getContext(),myButton!.getID())

PROCESS_EVENTS

APP_CLOSE:
RELEASE
RETURN

PUSH_BUTT:
DECLARE TextAlignable con!
con! = cast(TextAlignable, BBjAPI().getLastEvent().getControl())
if(con!.getAlignment() = con!.ALIGN_LEFT) release
con!.setAlignment(con!.ALIGN_LEFT)
con! = cast(TextAlignable, myWindow!.getControl(102))
con!.setAlignment(con!.ALIGN_LEFT)
RETURN
See Also

BBjAPI

BBjSysGui

BBjControl

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