BBjSysGui::getMeasure

Description

In BBj 11.0 and higher, this method returns the width in unscaled pixels of the specified string in the current active or focused window.

Syntax

Return Value

Method

int

getMeasure(string text)

Parameters

Variable

Description

text

Text to be measured.

Return Value

Returns the width in unscaled pixels of the specified text in the current active window. Throws an error if there is no current window.

Remarks

Equivalent to the 'MEASURE' mnemonic.

Example

rem ' BBjSysGui::getMeasure Example

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,400,200,"getMeasure",$00090003$)
print (sysgui)'font'(0,"Times New Roman",12,0)
window!.setCallback(window!.ON_CLOSE,"eoj")
text$ = "The quick brown fox jumps over the lazy dog."
measure = sysgui!.getMeasure(text$)
msg$ = "Text: " + text$ + $0a$
msg$ = msg$ + "Font: " + str(window!.getFont()) + $0a$
msg$ = msg$ + "Measure: " + str(measure) + " pixels."
print msg$
print (sysgui)'plottext'(10,50,text$)
print (sysgui)'line'(10,55,10+measure,55)
print (sysgui)'text'(101,10,100,measure,25,text$,$$)
print (sysgui)'font'(101,"Times New Roman",12,0)
print (sysgui)'backcolor'("yellow"),'colorset'(101)
i = msgbox(msg$,0,"getMeasure")
process_events

eoj:
release

See Also

BBjAPI

BBjSysGui::getMeasures

MEASURE Mnemonic - Measure Text (SYSGUI)

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