DatePicker controls and grDispAttr objects in a graph control
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.
To set the display format for a DatePicker control:
Select a value from the Format drop-down list on the General page in the Properties view.
To set the display format for a text object:
Display the Text tab page of the graph control’s Properties view.
Select a text object in the Text Object list box.
Enter an expression in the DisplayExpression field or select a format from the Format drop-down list.
The following line specifies that the DatePicker control should use the short date format:
dp_1.Format = dtfShortDate!
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:
dp_1.Format = dtfCustom! dp_1.CustomFormat = "MMMM dd, yyyy"
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:
gr__1.Values.DispAttr.Format = "0.00"
The following example specifies a string format for alphanumeric data:
gr_1.Category.dispAttr.Format = "@@@/AAA"