Supplying property values
Each property has its own set of property values that you
can use to specify for the true and false conditions in your If
expression. Usually you specify a number to indicate what you want.
For example, if you are working with the Border property, you use
the number 0, 1, 2, 3, 4, 5, or 6 to specify a border.
This section describes the valid property values for properties
you can control with the techniques described in this chapter.
Valid values of properties are shown parenthetically
in the Properties view wherever possible. For example, the dropdown listbox showing border selections
includes the correct number for specifying each border parenthetically
after the name of the border (ShadowBox (1), Underline (4)).
These are the properties:
Property | Painter option in Properties view | Description |
---|---|---|
Background.Color | Background Color on General page or Font page |
Background color of a control |
Border | Border on General page | Border of a control |
Brush.Color | Brush Color on General page | Color of a graphic control |
Brush.Hatch | Brush Hatch on General page | Pattern used to fill a graphic control |
Color | Text Color on Font page; Color on General page; Line Color on General page |
Color of text for text controls, columns, and computed fields; background color for the DataWindow object; line color for graphs |
Font.Escapement (for rotating controls) |
Escapement on Font page | Rotation of a control |
Font.Height | Size on Font page | Height of text |
Font.Italic | Italic on Font page | Use of italic font for text |
Font.Strikethrough | Strikeout on Font page | Use of strikethrough for text |
Font.Underline | Underline on Font page | Use of underlining for text |
Font.Weight | Bold on Font page | Weight (for example, bold) of text font |
Format | Format on Format page | Display format for columns and computed fields |
Height | Height on Position page | Height of a control |
Pen.Color | Pen Color on General page | Color of a line or the line surrounding a graphic control |
Pen.Style | Pen Style on General page | Style of a line or the line surrounding a graphic control |
Pen.Width | Pen Width on General page | Width of a line or the line surrounding a graphic control |
Pointer | Pointer on Pointer page | Image to be used for the pointer |
Protect | Protect on General page | Whether a column can be edited |
Timer_Interval | Timer Interval on General page | How often time fields are to be updated |
Visible | Visible on General page | Whether a control is visible |
Width | Width on Position page | Width of a control |
X | X on Position page | X position of a control |
X1, X2 | X1, X2 on Position page | X coordinates of either end of a line |
Y | Y on Position page | Y position of a control relative to the band in which it is located |
Y1, Y2 | Y1, Y2 on Position page | Y coordinates of either end of a line |
Background.Color
Description
Setting for the background color of a control.
In the painter
Background Color on the General property page or Font property
page in the Properties view.
Value
A number that specifies the control’s background
color.
For information on specifying colors, see “Specifying colors”.
Background color of a line The background color of a line is the color that displays
between the segments of the line when the pen style is not solid.
Transparent background If Background.Mode is transparent (1), Background.Color is
ignored.
Example
The following statement specifies that if the current row
(person) uses the day care benefit, the background color of the
control should be set to light gray (15790320). If not, the background
color should be set to white (16777215):
1 |
If(bene_day_care = 'Y', 15790320, 16777215) |
In this example, the condition is applied to the Background.Color
property for three controls: the emp_id column, the emp_fname
column, and the emp_lname column.
The following is a portion of the resulting DataWindow object. Notice
that the employee ID, first name, and last name have a gray background
if the employee uses the day care benefit:
Border
Description
The type of border for the control.
In the painter
Border on the General property page in the Properties view.
Value
A number that specifies the type of border. Values are:
- 0–None
- 1–Shadow
box - 2–Box
- 3–Resize
- 4–Underline
- 5–3D
Lowered - 6–3D
Raised
Example
The following statement specifies that if the current row
(person) has a status of L (is on leave), the status column should
display with a Shadow box border:
1 |
If(status = 'L', 1, 0) |
In this example, the condition is applied to the Border property
of the status column.
The following is a portion of the resulting DataWindow object. Notice
that the status On Leave displays with a Shadow box border:
About the value L and the value On Leave The status column uses an edit style. The internal value for
on leave is L and the display value is On Leave. The conditional
expression references the internal value L, which is the actual
value stored in the database. The DataWindow object shows the value On
Leave, which is the display value assigned to the value L in the
code table for the Status edit style.
Brush.Color
Description
Setting for the fill color of a graphic control.
In the painter
Brush Color on the General property page in the Properties
view.
Value
A number that specifies the color that fills the control.
For information on specifying colors, see “Specifying colors”.
Example
See the example for “Brush.Hatch”.
Brush.Hatch
Description
Setting for the fill pattern of a graphic control.
In the painter
Brush Hatch on the General property page in the Properties
view.
Value
A number that specifies the pattern that fills the control.
Values are:
- 0–Horizontal
- 1–Bdiagonal
(lines from lower left to upper right) - 2–Vertical
- 3–Cross
- 4–Fdiagonal
(lines from upper left to lower right) - 5–DiagCross
- 6–Solid
- 7–Transparent
Example
In this example, statements check the employee’s
start date to see if the month is the current month or the month
following the current month. Properties of a rectangle control placed
behind the row of data are changed to highlight employees with months
of hire that match the current month or the month following the
current month.
The Design view includes columns of data and a rectangle behind
the data. The rectangle has been changed to black in the following
picture to make it stand out:
The following statement is for the Brush.Color property of
the rectangle. If the month of the start date matches the current
month or the next one, Brush.Color is set to light gray (12632256).
If not, it’s set to white (16777215), which means it will
not show:
1 |
If(month( start_date ) = month(today())<br /> or month( start_date ) = month(today())+1<br /> or (month(today()) = 12 and month(start_date)=1),<br /> 12632256, 16777215) |
The following statement is for the Brush.Hatch property of
the rectangle. If the month of the start date matches the current
month or the next one, Brush.Hatch is set to Bdiagonal (1). If not,
it’s set to Transparent (7), which means it will not show:
1 |
If(month( start_date ) = month(today())<br /> or month( start_date ) = month(today())+1<br /> or (month(today()) = 12 and month(start_date)=1),<br /> 1, 7) |
Expressions are also provided for Pen.Color and Pen.Style.
For more about these properties, see “Pen.Style”.
The following is a portion of the resulting DataWindow object. A
rectangle with light gray cross-hatching highlights employees whose
reviews are due soon:
Color
Description
The color of text for text controls, columns, and computed
fields; background color for the DataWindow object; line color for graphs.
In the painter
In the Properties view, Text Color on the Font property page;
Color on the General property page; Line Color on the General property
page.
Value
A number that specifies the color used for text.
For information on specifying colors, see “Specifying colors”.
Example
The following statement is for the Color property of the emp_id,
emp_fname, emp_lname, and emp_birth_date
columns:
1 |
If(month(birth_date) = month (today()), 255, 0) |
If the employee has a birthday in the current month, the information
for the employee displays in red (255). Otherwise, the information
displays in black (0):
The Font.Underline property has the same conditional expression
defined for it so that the example shows clearly on paper when printed
in black and white.
The following shows a portion of the DataWindow object. Employees
with birthdays in the current month display underlined and in red:
Font.Escapement (for rotating controls)
Description
The angle of rotation from the baseline of the text.
In the painter
Escapement on the Font property page in the Properties view.
Value
An integer in tenths of degrees. For example, 450 means 45
degrees. 0 is horizontal.
Example
The following picture shows how you enter rotation for a control.
You select the control in the Design view and click the button next
to the Escapement property in the Properties view. In the dialog
box that displays you enter the number of tenths of degrees (in
this example, 450):
The following picture shows the Design view with a number
of text controls. Each text control shows the Font.Escapement value
entered and the number of degrees of rotation. In the Design view,
you do not see rotation; it looks as if the controls are all mixed
up. Two controls seem to overlay each other:
The next picture shows the same controls at execution time.
Each control is rotated appropriately:
How to position controls that are rotated Make the controls movable (display each control and select
the Moveable checkbox in the Position property page). Then in the
Preview view, click the rotated text control until a gray box displays
(try the center of the text). Drag the rotated control where you
want it. In the Design view, the controls will be wherever you dragged
them. They may look incorrectly positioned in the Design view, but
they will be correctly positioned when you run the DataWindow object. When
you are satisfied with the positioning, you may want to clear the
Moveable checkbox for the controls (to ensure that they stay where
you want them).
Font.Height
Description
The height of the text.
In the painter
Size on the Font property page in the Properties view.
Value
An integer in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels. To specify size in points, specify a negative
number.
Example
The following statement is specified for the Font.Height property
of a text control. The statement says if it’s the first
row, show the text 1/2-inch high (500 1/1000ths
of an inch) and if it’s not the first, show the text 1/5-inch
high (200 1/1000ths of an inch):
1 |
If(GetRow() = 1, 500, 200) |
The following picture shows the text control in the Design
view. Notice that the boundaries of the control had to be extended
to allow for the increased size of the text:
This is what the DataWindow object looks like at execution time.
The first occurrence of the text control is big (1/2 inch);
subsequent ones are small (1/5 inch). Note that the DataWindow object is
defined as using thousandths of an inch as its unit of measure:
Font.Italic
Description
A number that specifies whether the text should be italic.
In the painter
Italic on the Font property page in the Properties view.
Value
Values are:
- 0–Not
italic - 1–Italic
Example
The following statements are specified for the Font.Italic,
Font.Underline, and Font.Weight properties, respectively. If the
employee has health insurance, the employee’s information
displays in italics. If not, the employee’s information displays
in bold and underlined:
1 |
If(bene_health_ins = 'Y', 1, 0)<br /> If(bene_health_ins = 'N', 1, 0)<br /> If(bene_health_ins = 'N', 700, 400) |
Statements are specified in this way for four controls: the
emp_id column, the emp_fname column, the emp_lname
column, and the emp_salary column.
The resulting DataWindow object looks like this. Those with health
insurance display in italics. Those without health insurance are
emphasized with bold and underlining:
Font.Strikethrough
Description
A number that specifies whether the text should be crossed
out.
In the painter
Strikeout on the Font property page in the Properties view.
Value
Values are:
- 0–Not
crossed out - 1–Crossed
out
Example
The following statement is for the Font.Strikethrough property
of the emp_id, emp_fname, emp_lname,
and emp_salary columns. The status column must be included
in the data source even though it does not appear in the DataWindow object itself.
The statement says that if the employee’s status is L,
which means On Leave, cross out the text in the control:
1 |
If(status = 'L', 1, 0) |
An extra text control is included to the right of the detail
line. It only becomes visible if the status of the row is L (see “Visible”).
The following is a portion of the resulting DataWindow object. It
shows two employees who are On Leave. The four columns of information
show as crossed out:
Font.Underline
Description
A number that specifies whether the text should be underlined.
In the painter
Underline on the Font property page in the Properties view.
Value
Values are:
- 0–Not
underlined - 1–Underlined
Example
The following statement, when applied to the Font.Underline
property of columns of employee information, causes the information
to be underlined if the employee does not have health insurance:
1 |
If(bene_health_ins = 'N', 1, 0) |
For pictures of this example, see “Font.Italic”.
Font.Weight
Description
The weight of the text.
In the painter
Bold on the Font property page in the Properties view.
Value
Values are:
- 100–Thin
- 200–Extra
light - 300–Light
- 400–Normal
- 500–Medium
- 600–Semibold
- 700–Bold
- 800–Extrabold
- 900–Heavy
Most commonly used values The most commonly used values are 400 (Normal) and 700 (Bold).
Your printer driver may not support all of the settings.
Example
The following statement, when applied to the Font.Weight property
of columns of employee information, causes the information to be
displayed in bold if the employee does not have health insurance:
1 |
If(bene_health_ins = 'N', 700, 400) |
For pictures of this example, see “Font.Italic”.
Format
Description
The display format for a column.
In the painter
Format on the Format property page in the Properties view.
Values
A string specifying the display format.
Example
The following statement, when applied to the Format property
of the Salary column, causes the column to display the word Overpaid
for
any salary greater than $60,000 and Underpaid
for
any salary under $60,000:
1 |
If(salary>60000, 'Overpaid', 'Underpaid') |
Edit Mask edit style change The Edit Mask edit style assigned to the salary column had
to be changed. Because edit styles take precedence over display
formats, it was necessary to change the edit style assigned to the
salary column (an Edit Mask edit style) to the Edit edit style.
The following DataWindow object shows the values in the salary column
to be either the word Underpaid
or Overpaid
:
Height
Description
The height of the column or other control.
In the painter
Height on the Position property page in the Properties view.
Value
An integer in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
The following statement causes the height of a rectangle to
be .350 inches if the state column for the row has the value NY.
Otherwise, the rectangle is .200 inches high:
1 |
If(state = 'NY',350, 200) |
For more details and pictures, see “Example 4: changing the
size and location of controls”.
Pen.Color
Description
The color of the line or the outline of a graphic control.
In the painter
Pen Color on the General property page in the Properties view.
Value
A number that specifies the color of the line or outline.
For information on specifying colors, see “Specifying colors”.
Example
See the example for the Pen.Style property, next.
Pen.Style
Description
The style of the line or the outline of a graphic control.
In the painter
Pen Style on the General property page in the Properties view.
Value
Values are:
- 0–Solid
- 1–Dash
- 2–Dotted
- 3–Dash-dot
pattern - 4–Dash-dot-dot
pattern - 5–Null
(no visible line)
Example
In this example, statements check the employee’s
start date to see if the month is the current month or the month
following the current month. Properties of a rectangle control placed
behind the row of data are changed to highlight employees with months
of hire that match the current month or the month following the
current month.
The Design view includes columns of data and a rectangle behind
the data. The rectangle has been changed to black in the following
picture to make it stand out:
The following statement is for the Pen.Color property of the
line around the edge of the rectangle. If the month of the start
date matches the current month or the next one, Pen.Color is set
to light gray (12632256). If not, it’s set to white (16777215),
which means it will not show:
1 |
If(month( start_date ) = month(today())<br /> or month( start_date ) = month(today())+1<br /> or (month(today()) = 12 and month(start_date)=1),<br /> 12632256, 16777215) |
The following statement is for the Pen.Style property of the
rectangle. If the month of the start date matches the current month
or the next one, Pen.Style is set to Solid (0). If not, it’s
set to NULL (5), which means it will not show:
1 |
If(month( start_date ) = month(today())<br /> or month( start_date ) = month(today())+1<br /> or (month(today()) = 12 and month(start_date)=1),<br /> 0, 5) |
Expressions are also defined for Brush.Color and Brush.Hatch.
For more about these properties, see “Brush.Hatch”.
The following is a portion of the resulting DataWindow object. A
rectangle with light gray cross-hatching highlights employees whose
reviews are due soon. The line enclosing the rectangle is Light
Gray and uses the pen style Solid (0):
Pen.Width
Description
The width of the line or the outline of a graphic control.
In the painter
Pen Width on the General property page in the Properties view.
Value
An integer in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
The following statement causes the width of a line to be .05
inches if the state column for the row has the value NY. Otherwise,
the line is .01 inches wide:
1 |
If(state = 'NY', 50, 10) |
For more details and pictures, see “Example 4: changing the
size and location of controls”.
Pointer
Description
The image used for the mouse pointer when the pointer is over
the specified control.
In the painter
Pointer on the Pointer property page in the Properties view.
Value
A string that specifies a value of the Pointer enumerated
data type or the name of a cursor file (CUR) used for the pointer.
Values of the Pointer enumerated data type are:
- Arrow!
- Cross!
- HourGlass!
- IBeam!
- Icon!
- Size!
- SizeNESW!
- SizeNS!
- SizeNWSE!
- SizeWE!
- UpArrow!
Example
The following condition, entered for the Pointer property
of every control in a row of expense data, changes the pointer to
a column every time the value in the expense column exceeds $100,000.
Note that the pointer has no meaning in a printed report. The pointer
is for use on the screen display of a DataWindow object:
1 |
If(expense 100000, 'pbcolumn.cur', 'arrow!') |
Protect
Description
The protection setting of a column.
In the painter
Protect on the General property page in the Properties view.
Value
Values are:
- 0–False,
the column is not protected - 1–True,
the column is protected
Timer_Interval
Description
The number of milliseconds between the internal timer events.
In the painter
Timer Interval on the General property page in the Properties
view.
Value
The default is 0 (which is defined to mean 60,000 milliseconds
or one minute).
Visible
Description
Whether the control is visible in the DataWindow object.
In the painter
Visible on the General property page in the Properties view.
Value
Values are:
- 0–Not
visible - 1–Visible
Example
The following statement is for the Visible property of a text
control with the words On Leave located to the right of columns
of employee information. The statement says that if the current
employee’s status is L, which means On Leave, the text
control is visible. Otherwise, it’s invisible:
1 |
If(status = 'L', 1, 0) |
The status column must be retrieved The status column must be included in the data source even
though it does not appear in the DataWindow object itself.
The Design view includes the text control at the right-hand
end of the detail line. The text control is visible at execution
time only if the value of the status column for the row is L.
The following is a portion of the resulting DataWindow object. It
shows two employees who are On Leave. The text control is visible
only for the two employees on leave:
For the employees on leave, four columns of information show
as crossed out. This is specified with property conditional expressions
for those columns (described in the section on “Font.Strikethrough”).
Width
Description
The width of the control.
In the painter
Width on the Position property page in the Properties view.
Value
An integer in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
The following statement causes the width of a rectangle to
be .900 inches if the state column for the row has the value NY.
Otherwise, the rectangle is 2.000 inches wide:
1 |
If(state = 'NY', 900, 2000) |
For more details and pictures, see “Example 4: changing the
size and location of controls”.
X
Description
The distance of the control from the left edge of the DataWindow object.
At execution time, the distance from the left edge of the DataWindow object is calculated
by adding the margin to the x value.
In the painter
X on the Position property page in the Properties view.
Value
An integer in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
The following statement causes a rectangle to be located 6.250
inches from the left if the state column for the row has the value
NY. Otherwise, the rectangle is 4.000 inches from the left:
1 |
If(state = 'NY', 6250, 4000) |
For more details and pictures, see “Example 4: changing the
size and location of controls”.
X1, X2
Description
The distance of each end of the line from the left edge of
the DataWindow object as measured in the Design view. At execution time,
the distance from the left edge of the DataWindow object is calculated
by adding the margin to the x1 and x2 values.
In the painter
X1, X2 on the Position property page in the Properties view.
Value
Integers in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
The following statements for the X1 and X2 properties of a
line cause the line to extend from 6.250 to 7.150 inches from the
left if the state column for the row has the value NY. Otherwise,
the line extends from 4.000 to 6.000 inches from the left:
1 |
If(state = 'NY', 6250, 4000)<br /> If(state = 'NY', 7150, 6000) |
For more details and pictures, see “Example 4: changing the
size and location of controls”.
Y
Description
The distance of the control from the top of the band in which
the control is located.
In the painter
Y on the Position property page in the Properties view.
Value
An integer in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
For information, see “Example 4: changing the
size and location of controls”.
Y1, Y2
Description
The distance of each end of the specified line from the top
of the band in which the line is located.
In the painter
Y1, Y2 on the Position property page in the Properties view.
Value
Integers in the unit of measure specified for the DataWindow object.
Units of measure include PowerBuilder units, thousandths of an inch
(1000 = 1 inch), thousandths of a centimeter (1000 = 1
centimeter), or pixels.
Example
The following statements for the Y1 and Y2 properties of a
line cause the line to be located .400 inches (Y1 and Y2 equal .400
inches) from the top of the detail band, if the state column for
the row has the value NY. Otherwise, the line is located .250 inches
(Y1 and Y2 equal .250 inches) from the top of the detail band:
1 |
If(state = 'NY', 400, 250)<br /> If(state = 'NY', 400, 250) |
For more details and pictures, see “Example 4: changing the
size and location of controls”.