Schultz’s PowerBuilder Notes

Making DW Radio Buttons and Check Boxes look disabled


An effective GUI quickly communicates to the users  how they can interact with the current window.  For most datawindow edit styles, PowerBuilder supplies its developers with the means to visually show if  it is available to accept user input.  Unfortunately, if you are working with an older version of PB,  how to show  a disabled check box or a radio button is a  puzzle.  Here is how I deal with this issue.

Continue reading

Advertisements

March 17, 2009 Posted by | 2. Datawindows, Datawindow PowerScript, Expressions, Modify and Describe | , , , , , , , , , , , | 9 Comments

Datawindow Button


Disabling a button on a datawindow

Datawindow buttons do not have a Disabled property. So showing them as “disabled” is not clear cut. Here is one way

Continue reading

May 22, 2008 Posted by | Datawindow PowerScript | , , , , | Leave a comment

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 | , , , , , , , | 4 Comments