PreviousDialog System V2.5

Chapter 9: Panels V2

Panels V2 is included unchanged in NetExpress for backward compatibility, but it is not documented, as it is not recommended for new applications. Certain functions that can be accessed explicitly through Dialog System are documented in the Dialog System documentation.

If you want to develop further an existing application that you wrote using Panels V2, we recommend you keep the existing Panels V2 code but do any further development using the Object Orientation (OO) class library. This chapter shows you how you can do this.

9.1 Method

The sample program \Netexpress\Base\Demo\Pan2oo\Pan2oo.cbl is provided to be looked at along with this chapter. It illustrates how to use Panels V2 and the class library together. It uses Panels V2 to create a window, and has had code added to use the class library to create a button on that window. To add the button, it uses:

The following sections explain the code in Pan2oo.cbl.

9.1.1 Initializing Panels V2

The following code was added to initialize Panels V2 for class library use:

* New call - initialize the class library
     move Pf-Load-Class-Library to P2-Function
     call PANELS2 using P2-Parameter-Block.

This call tells Panels V2 to load the GUI Class Library. You must make this call in order for Panels V2 and the class library to co-operate. The class library will take control of the Windows event handling.

9.1.2 Creating the OO Objects

The following code declares the class and file names of the objects we want to use in the GUI Class Library:

 class-control.
     window is class "awindow"
     pushbutton is class "pushbutt".

The following declares the variables for each object used:

 working-storage section.
 01 aWindow object reference.
 01 aButton object reference.

The following creates a pushbutton on the window:

* Get class library object reference for this handle
     invoke window "fromhandle" 
         using window-handle returning aWindow
* Create a new push button on the window
     invoke pushbutton "new" 
         using aWindow returning aButton
     move 10 to button-x
     move 10 to button-y
     move 300 to button-w
     move 100 to button-h
     invoke aButton "setRectangle" 
         using button-x button-y button-w button-h
     invoke aButton "setLabelZ" using z"Test"
     invoke aButton "Show"

9.1.3 Event Handling

The following declares an entry point and tells the GUI class library to call it whenever a particular event happens:

 78 BC-Entry "buttonClicked".
* We want to know about "button clicked" events
     move p2ce-clicked to event-index
     invoke aButton "setEventToEntry" 
         using event-index BC-Entry & x"00".
* This is the callback for "button clicked" events.
* lnkEvent is an object of class "event"
 ButtonClicked section.
     entry BC-Entry using lnkEvent.
     display "The button was clicked!"
     exit program.


Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
PreviousDialog System V2.5