contents.gifindex.gifprev1.gifnext1.gif

4.1 Handles

Most of the graphically-oriented features of ACUCOBOL-GT make use of handles. A handle is a COBOL data item. Internally, a handle is simply a number. The COBOL program uses handles to identify various graphical items. Normally, when you create a graphical object, the runtime system generates a unique value to identify that object, and stores that value in the program's specified handle. You make future references to that object by naming its handle.

If you have worked with ACUCOBOL-GT's text-based subwindows (textual, pop-up windows), you are already familiar with the use of handles. The POP-UP AREA phrase of the DISPLAY WINDOW verb names a PIC X(10) data item that holds the handle of the created window. When you want to remove the window, you use that data item in the CLOSE WINDOW verb. The data item tells the system which window to close.

There is a data type, called USAGE HANDLE, that you use when you want to declare a handle data item for a graphical control. Another data type, USAGE HANDLE OF MENU, is available for declaring a handle for a menu.

When you make use of graphical objects in the Screen Section, the runtime system automatically creates and manages the associated handles for you. In this case you do not explicitly use handles when referring to graphical objects.

The runtime system can tell when a handle is no longer valid. If you make reference to an invalid handle (for example, a handle to an object you have destroyed), the requested operation is simply ignored.