One of the most useful custom objects that I've ever written is my
master_detail object. It holds a prominent place in my toolkit. This article
will take you through the steps of how to write one and in the process
de-mystify the object.
First we want something that looks like Figure 1. Selecting a row in the top
DataWindow will display the details in the bottom. I'm sure that you've seen
this kind of DataWindow and you've probably written many of them. The key
here is not to tell you how to write this but how to simplify every one that
you will write in the future. For our example I will again use the example
database that came with PowerBuilder.
To build the control I first need to create a new custom object. I click on
File-New in the menu or just hit Ctrl-N and I get the dialog in Figure 1.
I've circled what you need to click on to make it easy for you.
Once y... (more)
Service objects were introduced for PowerBuilder at about the same time as
the PowerBuilder Foundation Classes. Much like the PFC, most programmers
found reasons not to use them. In this article we will reduce the complexity
of these objects and in so doing perhaps open a new world of efficient
objects that are easily maintained and understood.
This article is going to create a service object for the DataWindow. The idea
behind this object and others like it is to minimize the footprint of the
DataWindow. We want to minimize the amount of memory that the DataWindow
requires and ... (more)
We are going to create a bare-bones email object. Of course you can expand
that in the future if you like, but for now, let's just create the
functionality that we need.
I start by creating a custom class. In case you aren't familiar with the
process look at Figure 1.
Let's start with an instance variable.
N_cst_mailer Instance Variables
private mailMessage io_mail_message // The message to send
I made the instance variables private so let's write a couple of functions to
populate our mail Message. We'll start with the TO. Note that the
io_mail_message contains an array of objec... (more)
Have you ever seen a form that has its own microhelp that changes when a
field gets focus? I'm sure you have. You might see a window and at the bottom
of the window is a line that says, "OPTIONAL - Enter the employee birth
date," when a field is entered. We are going to create a simple automated
solution that will allow you to carry the microhelp along in the DataWindow.
Take a look at Figure 1. It's a freeform DataWindow with a SQL data source. I
chose the Employee table from the sample database that comes with
PowerBuilder. I didn't do anything special to it. My goal here is to ... (more)
This is the second part of a two-part article. In the last article we learned
how to use the tag property to create our own microhelp and automate it. In
this article we are going to go one step further and use the tag property for
other things.
The list of items that I used the tag property for has shrunk over the years
as Sybase has tried to give us more tools. Apart from the microhelp the most
common use I had was to implement a tool tip. Now Sybase gives us a tool tip
without our having to code a pop-up window.
Luckily I don't have to have a long list of items; one more is su... (more)