Sometimes it simply doesn't matter whether you use a function or an event,
just pick one and stick to it
This article will shed some light on the differences between the two ways of
implementing scripts in PowerBuilder: functions and events. I will discuss
the issues in detail, giving background information on each of them. Then
you'll be able to decide for yourself when to use which.
In the old days of PowerBuilder, functions and events were a different kind
of beast. But as PowerBuilder evolved, functions and events became more and
more similar. Now many programmers aren't sure what the differences are, and
when to use which.
In the Sybase PowerBuilder newsgroups (see news://forums.sybase.com) you'll
find a wealth of information, but I didn't find a thorough and up-to-date
posting on the issue. So in this article I will tell you the similarities and
the differenc... (more)
First the good news: PowerBuilder is a great tool; in fact you can't
accidentally do much wrong. This strength is based on a number of reasons.
The following is list of why I think PowerBuilder is so great, but you might
like to add one or two more items to it:
PowerScript is simple; it's easy to learn because of its clearly laid out
grammar. PowerScript is a strongly typed language; many problems simply don't
arise because of the compiler telling you about an error. PowerScript is easy
to read. PowerBuilder itself takes care of the tedious task of correct
indentation. Thus Powe... (more)
Interfaces are one of the most important concepts that have found their way
into modern software engineering in the past couple of years. Java, COM,
CORBA, C# - all those languages/concepts support interfaces. PowerBuilder
does not. This article shows you how to sneak the interface concept into PB
by using some of its special features.
So Many Interfaces - What This Article Is Not About
The term interface is a common one in software engineering. In this article,
I define interface to mean "named collection of method definitions." We
especially don't deal with:
The PBNI, the PowerB... (more)
Wouldn't it be nice if we could use DataWindows, DataStores, and
DataWindowChild objects in the same way? This article shows you how.
In Part 1 (PBDJ, Vol. 9, issue 11) I described a way to implement Java's and
C#'s interface concept into PB. We did the following: Created a wrapper class
(the "interface") that has a reference to a PowerObject as an instance
variable Created a method within the wrapper class for every method of the
interface Called the actual method per dynamic call Encapsulated the call
with a TRY/CATCH-block in PB 8 and above At runtime, created the interface
o... (more)
PowerBuilder comes with a wide range of enumerated data types, and the values
are easily distinguished by the exclamation mark at the end. However, there
is no way to build your own enumerated data type in PowerScript, and it seems
that even PB 10 won't help us that much here. (Keep your fingers crossed that
user-defined enumerateds will be a part of PB 11.) This article shows how to
build a self-describing and robust enumerated data type and discusses the
ideas behind it.
Stage 0: Using Numbers
From the beginning PowerBuilder programmers used numbers to code states in
their pr... (more)