Schultz’s PowerBuilder Notes

PowerBuilder Special String Characters


Character Meaning

~n New Line
~f Form feed
~r Carriage Return
~b Backspace
~t Tab
~v Vertical tab
~” Quote
~~ Tilde
~nnn ANSI character numeric
~hnn ANSI character hex
~onn ANSI character octal

Advertisements

May 6, 2008 Posted by | Powerscript | , , , , , , , | 4 Comments

PowerBuilder Colors


RGB

Deriving RGB values. The formula for combining primary color values into a number is:

256*256*blue + 256*green + red = number

where the amount of each primary color is specified as a value from 0 to 255. For example, to specify cyan, substitute 255 for blue, 255 for green, and 0 for red. The result is 16776960.

The table below lists the blue, green, and red values you can use in the formula to specify other colors.

Blue

Green

Red

Number

Color

0

0

255

255

Red

0

255

0

65280

Green

0

128

255

32768

Dark Green

255

0

0

16711680

Blue

0

255

255

65535

Yellow

0

128

128

328896

Brown

255

255

0

16776960

Cyan

192

192

192

12632256

Light gray

255

255

192

Pale yellow

100

100

100

Dark Gray

System Colors

The current frameworks have a data color service to fetch the various system colors. To make use of this, call inv_datacolors.

long ll_selected_text

IF NOT IsValid(gnv_cst_app_object.inv_datacolors) THEN
   gnv_cst_app_object.of_SetDataColors(True)
END IF

ll_selected_text = gnv_cst_app_object.inv_datacolors.of_SelectedColor()
this.textcolor = ll_selected_text

The function calls are:

  • gnv_cst_app_object.inv_datacolors.of_SelectedColor( ) // Selected background
  • gnv_cst_app_object.inv_datacolors.of_EnterableColor( ) // window text
  • gnv_cst_app_object.inv_datacolors.of_ReadOnlyColor( ) // buttonface
  • gnv_cst_app_object.inv_datacolors.of_SelectedTextColor // Selected text color

You can also hard code an RGB like value for various system colors. These are handy for using in datawindow expressions. Sorry, no Selected or Selected Text colors that I am aware of.

67108864

ButtonFace

1073741824

WindowBackground

33554432

WindowText

268435456

ApplicationWorkspace

553648127

Transparent

  • 2^25 – Window Text
  • 2^26 – buttonface
  • 2^27 – scrollbar background
  • 2^28 – app. workspace
  • 2^29 – transparent
  • 2^30 – Window Background
  • 2^31 – unused
  • 2^32 – unused

May 2, 2008 Posted by | 1. PowerBuilder General, Powerscript | , , , , , , , | 5 Comments