Schultz’s PowerBuilder Notes

Opening up a Window from a Menu Item


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

Continue reading

Advertisements

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

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?

tab_1.SelectTab(3)

tab_1.SelectTab(tab_1.uo_3)

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?

Rte_1.SelectText(3,1,0,0)

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

Rte_1.InputFieldInsert(“company_name”)

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