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

Powerbuilder IDE


How do I have PowerBuilder ask for confirmation when exiting the development environment?

Don’t you hate it when you want to close your unchanged object and your fat fingers exit PowerBuilder instead?

In the PowerBuilder System Options dialog window, check the Prompt on Exit option

In PowerBuilder 7.0, Systems Options is under the Window menu column.

How can the application determine if it is running in development mode or as an exe?

You can determine that you are in development mode by using the Handle(GetApplication()) function. If it returns 0, you’re in dev mode. Otherwise, you’ve started the app as an EXE.

May 6, 2008 Posted by | 1. PowerBuilder General | , , , , , , | 1 Comment

Temp Tables


How do I destroy a temp table (Sybase)

Example:

Continue reading

May 6, 2008 Posted by | Database, Powerscript | , , , , , | 1 Comment

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

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

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

Extended Attributes


What is the PowerSoft Repository?

The Powersoft repository (AKA Powersoft Catalog) is a series of 5 tables containing extended attributes pertaining to a data table and its columns. These attributes contain information such a s labels, headings, display formats, validation rules, and edit styles.

Do not confuse the database catalog with the repository. The database catalog contains column definitions, initial values, constraints, and referential integrity rules and has no relationship with the PowerSoft repository.

How can I modify a table with out dropping it and clobbering the extended attributes?

1. Use the “Object|Export syntax to log” menu selection to save the data table syntax to the painter log.

2. Select Design|Save Log As to save the log to a file. The log contains both the syntax and INSERT statements that populate the repository with the extended attributes for the table.

3. Make changes to the SQL statements in the saved file, import the file into the Database Administration painter notepad, and execute the statements to recreate the table and populate the repository.

Or you could use a database design tool

How do I synchronize the repository?

When data tables are deleted outside the Database painter, for example using DROP table from SQL Plus, extended attributes associated with the deleted table remain in the repository. This information is now orphaned and takes up space.

To remove orphaned attributes from the repository, select Design|Synchronize PB Attributes in the Database painter. This menu items compares all attribute information to the list of existing tables and purges attributes for tables that no longer exist.

Warning: make sure you have access to all the data tables, otherwise you risk deleting extended attributes for tables that you can’t see.

What is DWEAS Utility?

The DataWindow Extended Attribute Synchronizer (DWEAS) lets you update many of the attributes of an existing DataWindow object with the current extended attribute values from the Powersoft repository.

This is important because when a new DataWindow is built, its extended attributes are gathered from the current values in the repository. When the values change, the object attributes are not automatically updated.

May 6, 2008 Posted by | Database, Datawindow Painter | , , , , | Leave a comment

Using a Menu on a Response window to give you Key Short Keys


Aron wanted a datawindow to be able have all the standard windows shortcut key “<cntl> A” for “Select All”. He was using the PFC multi row select, so he was able to give the standard <Cntl> and <Shift> extended selection.

His solution was to use a hidden menu where the Select All menu item is triggered by the shortcut key “<Cntl> A”. This problem was complicated by the fact that the window was a Response window, and needed to have the menu assignment done dynamically. Here is the code he put in the PreOpen Event.

menu lm

// m_response_edit is menu inherited from m_frame

int i

// In order to make keyboard shortcuts available, create a hidden menu
If Not IsValid(This.menuId) Then
   // Instantiate the menu
   This.ChangeMenu(m_response_edit)
   lm = This.menuId

   // Hide the menu and it's first level items
   lm.visible = False
   For i = 1 To UpperBound(lm.item)
      lm.item[i].visible = False
   Next
End if

May 6, 2008 Posted by | Menus | , , , , , | 1 Comment