You can specify the text and text display characteristics for a control in the Properties view for the control. You can also use the Window painter StyleBar to change:
-
The text itself
-
The font, point size, and characteristics such as bold
-
The alignment of text within the control
CommandButton text
Text in CommandButtons is always center aligned.
The default text for most controls that have a text property is none. To display an empty StaticText or SingleLineEdit control, clear the Text box in the Properties view or the StyleBar.
When you add text to a control's text property, the width of the control changes automatically to accommodate the text as you type it in the StyleBar, or when you tab off the Text box in the Properties view.
To change text properties of controls:
-
Select one or more controls whose properties you want to change.
-
Specify changes in the Font tab page in the Properties view, or specify changes using the StyleBar.
A control's text size is specified in the control's TextSize property. PowerBuilder saves the text size in points, using negative numbers.
For example, if you define the text size for the StaticText control st_prompt to be 12 points, PowerBuilder sets the value of st_prompt's TextSize property to–12. PowerBuilder uses negative numbers to record point size for compatibility with previous releases, which saved text size in pixels as positive numbers.
If you want to change the point size of text at runtime in a script, remember to use a negative value. For example, to change the point size for st_prompt to 14 points, code:
st_prompt.TextSize = -14
You can specify text size in pixels if you want, by using positive numbers. The following statement sets the text size to be 14 pixels:
st_prompt.TextSize = 14