Site hosted by Build your free website today!


PowerBuilder - Tips, Tricks, and Hints

Turning on the Debug file generation

Column Protection depending upon Datawindow isRowNew method :

  1. Set the column's background color to White
  2. Under "Expressions"
    1. In the "Background.color" field : if( isRowNew(), rgb(255,255,255), 78682240 )   // 78682240 is buttonface - J.Vogel
    2. In the "protect" field : if( isRowNew(),0, 1 )

Turning off the PB Catalog Tables - Since very few people actually use them for intended purpose theeasiest thing to do is to turn them off. pb.ini:


Automatically starting one of the "painters" when PowerBuilder starts

Passing "dwo" (e.g. Triggering ItemChanged)

General Design Considerations

Transparent Text

Data and Dot Notation

Triggering the PFC Error Object WITHOUT Triggering a System Event

Printing Datawindows

Converting between Grid and Tabular Datawindow Styles and Vice-Versa

Viewing the contents of a Datawindow or Datastore

Writing to the NT Application Log


Returning a return code to the DOS commandline

Concatenating the regular PowerBuilder Help file and PFC (PowerBuilder Foundation Class) Help

View standard PB Help and PFC concatenated together in one file :

Open "PBHLP80.CNT" in Notepad and add the below line

:Index PB Foundation Classes=pbpfc80.hlp

After this you can see Powerbuilder help file concatenated with PFC help file

Number of selected rows
ll_SelectedCount = Long(dw_1.Describe("Evaluate('sum(if (IsSelected(),1, 0) for all)',1)"))
Force Autoresize

If you have external datawindows with the autosizeheight property set to TRUE.  The band doesn't automatically re-calculate when you insert data into columns that expand their height.

The script hereunder forces the dataobject to re-calculate the height of the detail band.

// Get the row that is currently the 1st one visible
ll_FirstRowOnPage = Long(this.Object.DataWindow.FirstRowOnPage)
ll_row = This.GetRow()
ll_current_column = This.GetColumn()

// Remove the AutoSizeHeight property

// Restore the AutoSizeHeight property
Get an entire column of data

// Get entire EmailAddressID column's data
ll_email_address_id[] = ids_email.OBJECT.internet_address_id.PRIMARY

DevNote : Where internet_address_id is the actual column name (in other words, it can't be a constant or a dynamic string).

Dynamically routing DataWindow PCL output to a file There are many times that it is necessary to bypass a printer and route DataWindow output directly to a file for processing without changing the current default printer.

This is easily accomplished by using the file attribute of the print DataWindow property:

dw_1.Object.DataWindow.Print.Filename = "drive:\filename.prn"

The filename attribute is a string containing the name of the file to which you want to print the report. An empty string means send to the printer

Tip by: Keith Deron

Get the current database username