Format – PB Docs 150

Format property for PowerScript controls

Controls

DatePicker controls and grDispAttr objects in a graph control

Description

DatePicker controls

The Format property for DatePicker controls specifies the
format of the date displayed in the DatePicker control. The property
takes a value of the DateTimeFormat enumerated variable. Long and
short date and time formats are determined by the regional settings
in the Windows control panel on the local computer. Values are:

  • DtfCustom! – use the
    format specified in the CustomFormat property

  • DtfLongDate! – display a long
    date (default)

  • DtfShortDate! – display a short date

  • DtfTime!– display a time

grDispAttr objects

The Format property for grDispAttr objects allows you to define
display formats for text objects in graphs. Display formats are
masks in which certain characters have special significance.

The characters you use for formatting depend on the datatype
of the data. PowerBuilder supports four kinds of display formats:

  • Numbers

  • Strings

  • Dates

  • Times

You can specify colors in any display format by specifying
a color keyword before the format.

For more information about using colors and each kind of display
format, see “Using colors with display
formats”
and the sections that follow it.
For more information about defining display formats, see the PowerBuilder Users
Guide.

Usage

In a painter

proc.png To set the display format for a DatePicker control:

  1. Select a value from the Format drop-down
    list on the General page in the Properties view.

proc.png To set the display format for a text object:

  1. Display the Text tab page of the graph
    control’s Properties view.

  2. Select a text object in the Text Object list box.

  3. Enter an expression in the DisplayExpression field
    or select a format from the Format drop-down list.

In scripts

The following line specifies that the DatePicker control should
use the short date format:

The CustomFormat property takes a string value. The following
statements set the Format property to allow a custom format, then
set the custom format to display the full month name and the two-digit
date followed by a comma, and the full year:

For grDispAttr objects, each type of display format uses special
characters that have special meaning for that format. The Format
property takes a string value composed of these special characters.

The following example specifies a format for numeric data
that always displays three digits, with two decimal places:

The following example specifies a string format for alphanumeric
data:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x