This chapter explains how to use some of the methods and properties supplied with PowerCOBOL. You can think of methods as useful built-in functions or subprograms. Properties can generally be thought of as data items that contain some value important to the internal workings of a control.
You may additionally come across the use of the term dialog in describing methods. The Windows operating system provides several useful common dialogs to aid developers. Dialog is used to describe certain methods that allow user interaction, such as selecting a file name to open.
The terms method and property actually come from object-oriented programming terminology. In object-oriented programming, objects are collections of data encircled by the methods (functions) that act upon that data. The data is typically encapsulated and thus only accessible by first going through the object's methods. This prevents outside applications and methods from having direct access to the data, therefore ensuring that the data is only manipulated using the methods designed for it.
Properties are typically data items within an object that do not require a method to access them. Controls are typically designed to take some action when a particular property is changed. For example, simply moving a new color to a form's background color property (BackColor) will cause the form's background to change to the new color without being forced to call a method.
The Windows operating system graphical user interface (GUI) is highly object oriented and provides a number of methods and properties available at a low level to interact with it.
PowerCOBOL abstracts these lower level methods and properties and provides a set of higher-level methods and properties to make the building of GUI applications more straightforward to its users.
These methods and properties will vastly simplify and solidify your development efforts. For example, the GetFileName dialog will present the common Windows Open File dialog box and allow a user to browse drives and directories to find a file name to open. Writing the code for this method from scratch is both tedious and complex. Having the already well-tested method available makes it a snap.
Moving the value of False (provided as a constant in PowerCOBOL named POW-FALSE), to the Visible property available in many controls will make the entire control or even a complete form invisible. Move the value of True (POW-TRUE) to the same property will cause the control to become visible again.
This chapter will provide useful information on how to use some of these supplied methods and properties. The PowerCOBOL on-line help system contains information on every method and property available in PowerCOBOL. It also contains coding examples. If you are new to this type of programming you should spend some time examining these in the help system. PowerCOBOL additionally comes with many sample programs found be default in the Program Files\Fujitsu NetCOBOL for Windows\COBOL\SAMPLES\PowerCOBOL subdirectory. You should examine these projects to learn how to use controls and their supplied methods and properties if you need additional help.