Introduction to PowerBuilder

HomePrevious Lesson: DataWindow Control
Next Lesson: Horizontal and Vertical Scrollbars

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.

Another way of accomplishing the same is to define a 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 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 a User object is.
HomePrevious Lesson: DataWindow Control
Next Lesson: Horizontal and Vertical Scrollbars