What's the word for a set of objects: DataWindows, DataStores, or
DataWindowChilds? If there is a word, I don't know it. Objects don't have any
relationship in the PowerBuilder object hierarchy, so that doesn't help.Let's
call them DataObjects...oops, that's taken! Lacking any other word, let's
stipulate that the term DataWidgets refers to these various DataWindow-ish
types.
Many native PB functions work for all kinds of DataWidgets. SetItem() applies
to DataWindows, DataWindowChilds, and DataStores, for example; so do the
GetItemX() functions, such as GetItemString() and GetItemNumber(). It's nice
that these functions operate identically for all DataWidget types. If I know
how to call SelectRow() for one, I can call it for the others.
Which brings up the problem addressed in this article.
One of my PowerBuilder pet peeves is the fact that a user-written function
c... (more)
Overloading allows two or more functions to have the same name and return
type, if their signature is different. The function signature is defined by
its number and types of arguments. When you call an overloaded function,
PowerBuilder decides which version of the function to call based on the
function signature. This can be exploited to determine an object's type at
runtime. This article presents a couple of practical applications of this
technique, and describes a third situation where a different technique is
required.
Technique 1:
Validating Arguments
I first used this metho... (more)
PowerBuilder provides an object browser - the utility accessed via the "Cubes
with a pair of eyeglasses" icon on the PowerBar menu. If you haven't tried
the PB browser, you should. Among other things, it eliminates the problem of
identifying which PBL contains the object of interest. Click a tab to select
an object type and you're immediately presented with a list of the current
application's objects of that type. Right-click an object, select Edit from
the popup menu and PB opens the object in the relevant painter. It's a fast
way to navigate your PB application.
The PB browser... (more)
Over the years we've adopted techniques that help us develop our PowerBuilder
applications faster and with fewer bugs. This article describes my favorite
bag of tricks, the pop-up debug menu (see Figure 1).
The debug menu is for developers only and is unavailable when running an
executable. Most of the menu items are express aids to development: What is
this object and which PBL contains it? Show me the SQL that failed. What is
the value of the key column? Replace those SQL question marks with the actual
data values. Other items are intended to make it easier to do quality
contr... (more)
In my previous article (PBDJ, Vol. 8, issue 2), I demonstrated the Object
Name feature of the debug popup menu. The popup menu is a developer's tool
invoked by holding down a magic key as you right-click a window or control.
The initial and most useful debug menu item is Object Name, which you can use
to identify any object in your PowerBuilder application as you run the
application. Selecting Object Name as you right-click a DataWindow produces
output like that shown in Figure 1.
Each line in the message box represents a level in the object hierarchy, with
the upper item contai... (more)