Introduction to PowerBuilder
User Object
User Object is an object that is defined
for reusability purpose. An example would be to display microhelp whenever mouse pointer
moves over any CommandButton. What is the best way to do it? Method one would be ( which
is not the best one ), to write script for each and every CommandButton in the
application. It works fine; but the drawback of this method is that you duplicate code at
each CommandButton. If a need to change some functionality occurs, you need to change code
in all CommandButtons. It is time-consuming and the probability of missing some places is
more.
An other way of accomplishing the same is
to define an User Object of type CommandButton and write code there. Start using this new
User Object instead of the Standard CommandButton. Here, you are not duplicating the code,
instead you are reusing it. When you want to change a functionality, apply the same in the
User Object and you are done.
We won't go into details here, because,
explaining User Objects takes a session by itself. Here we just wanted you to know what an
User Object is.
At this point, we don't have anything for practice. It would be
waiting for you after completion of "User Object" session.
|