Schultz’s PowerBuilder Notes

PFC Window Basic Service

How do I center a window into the center of the screen?

This should be done for most response and pop up windows:


June 12, 2008 Posted by | 3. PFC, Window Services | , , , | Leave a comment

How come my dddw pops up a response window asking for retrieval arguments when I try to insert a row?

If the datawindow tries to insert a new row, and the dddw is not yet populated, the response window asking for Retrieval Arguments will be displayed.  Here are 3 ways to solve this problem:

  1. Get the handle of the DDDW using GetChild, SetTransObject() and Retrieve() before the parent is filled. Then filter the invalid rows based on the values of the columns entered. This works fine if there are only a modest number of rows in the DDDW universe and this data is static.
  2. Pre-store data in the DDDW in the DataWindow painter. Then filter the invalid rows based on the values of the columns entered. This requires the data to be static. If it is not, the datawindow has to be updated, and a new build will need to be deployed.
  3. Get the handle of the DDDW using Get Child and InsertRow() to give it a result set. The DDDW will have a blank row, but at least the annoying response window will not be in the user’s face. The row with the DDDW is protected until all the columns from which retrieval arguments are derived are entered. Then the DDDW is populated with a retrieve (or copied from a cache).

May 10, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , | 1 Comment

Opening up a Window from a Menu Item

1) Create the following user event in your application’s frame window

Continue reading

May 6, 2008 Posted by | Menus, Powerscript, Window Controls | , , , , , , , , , , | Leave a comment

Window Types

Main window

A standalone window that can be independent of all other windows. You use the main window as the anchor for your application. The first window your application opens is a main window (unless you are building an MDI application, in which case the first window is an MDI frame).

Popup window

A window that displays only in response to an event within a window but can exist outside the window and, in some cases, after the window that opened it is closed.

The popup window may or may not have a parent window. When it has a parent window, it is dependent. The popup is hidden when the parent is minimized and visible when the parent is maximized (it is never overlapped by the parent). When the popup window does not have a parent, it is independent and can be overlapped by the window that opened it. When you minimize a popup window, the icon for the popup displays outside the window (regardless of whether it has a parent).

Child window

A window that is dependent on a main (parent) window and can exist only within the parent window. The initial position of the child is relative to the parent and not to the workspace. You can move the child within the parent, but not outside the parent.
When you move part of the child beyond the parent, PowerBuilder clips the window so that only the portion within the parent is visible. When you move the parent window, the child moves with the parent and maintains the same position relative to the parent.
When you minimize a child window, the icon displays within the parent.

Response Window

The window that displays to request information from the user and to which the user must respond. A response window is always opened from within another window (its parent). Typically, a response window is opened after a specific event occurs in the parent window.

A response window is application modal: when it displays, it is the active window (it has focus) and no other window in the application is accessible until the user responds to it. The user can go to other Windows applications; but when the user returns to the application, the response window is still active.
A response window acts like a modal popup window.

May 6, 2008 Posted by | Window Controls | , , , , , , , , | Leave a comment

Open Event Sequence

Here is the order windows events fire

Main Window

  1. Open
  2. Activate
  3. Show
  4. Resize

MDI Sheet

  1. Open
  2. Resize
  3. Show
  4. Activate

May 6, 2008 Posted by | Window Controls | , , | Leave a comment

Migrating PB9 Objects to PB7

You may find yourself working in PB 7 and wanting to use a DataWindow developed in PB 9.  Some objects are easier than others.


Datawindows are addressed specifically in the previous post.  Take a look there

Windows and User Objects

Try opeingi up the  PB 9 version in PB 7.   If this works, Just save it and you are good to go.   If blows up,  here are several  possible causes:

  • An invalid global variable is being referenced
  • A non-standard variable is of a datatype which was not included found in the search path
  • A non-standard variable refers to an object which has not yet been migrated to PB 7

You can clean up the code by editing the .srw export file with a text editor and commenting out the offending references.  When you import the file, make sure the PB 9 version is not in your library path, otherwise the import will fail.  You will not get a helpful error message or PowerBuilder will crash.

April 17, 2008 Posted by | 1. PowerBuilder General, PowerBuilder Versions | , , , , , , , , , , | Leave a comment

Tab Object

Selection Changing Event

Return Values:

0 – Allow the selection to change

1 – Prevent the selection from changing

How do I select a particular tabpage in script?



The tab identifier can be

· The tab page index (an integer)·

· The name of the user object (data type DragObject or UserObject)

· A string holding the name of the user object

April 5, 2008 Posted by | 1. PowerBuilder General, Window Controls | , , , , , | Leave a comment

Rich Text Edit

A rich text edit control is generally more sophisticated than a rich text DataWindow.

· Capable of insert, edit and delete of input fields dynamically

· Can save as RTF file

· Multiple undo processing

How do I create?

  1. Drop control and set properties
  2. Provide methods to insert the text. Inserting text can be done manually or programmatically.
  3. Prove methods to place input fields. The InputFieldInsert function is used. Column name must match DataWindow column name.
  4. Provide methods to merge the data with DataStore.

How do I load the rich text edit control programmatically?

1) Use the InsertDocument( ) function. A true will replace existing document, false will append.

Rte_1.InsertDocument(“mydoc.rtf”, true)

2) Use the SelectText( ) function to position text?


3) Use the InputFieldInsert( ) function to insert the text


April 5, 2008 Posted by | 1. PowerBuilder General, Window Controls | , , , , , , | Leave a comment