Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

10.1.5 Using Drag and Drop and Selection Lists with the PowerCOBOL Editor to Find Available Methods

The PowerCOBOL Editor provides two useful features for creating proper code to invoke methods.

Whenever you have the Form Editor active and you have an active PowerCOBOL Editor window together with it, you may use drag and drop to begin this process.

To use drag and drop, you need to be able to view the current form containing the control you are interested in. You also must be able to view at least part of the Editor window containing the location you wish to create COBOL code to invoke a method.

Move the cursor in the Editor window to the location you wish to create the COBOL INVOKE statement for the method. Next, move the mouse pointer over the Form and left-click on the control you wish to invoke a method on.

Holding the left mouse button down, drag the control (or form) into the Editor window and release the mouse button to drop it onto the edit session. Don't worry - this will not move an actual control to a new location within the form.

The name of the control you dragged into the Editor window will now appear at the current cursor location.

For example, if you had a form open in the Form Editor that contained a command button named "ButtonOK" on it, you could create an event procedure for its click event.

While the edit session is open for the click event, you could move the mouse back to the form and drag the command button (or any other control) over to the Editor window and drop it on the Editor window.

The Editor window would then appear as follows:

Figure 10.1 The Editor window after dragging a control and dropping it

You may alternatively simply type in the name of the control. The drag and drop feature is especially useful when you do not remember the name of the control or when it has a long name.

Once you have the name of the control in the Editor window, highlight it as shown in figure 10.1 above. Now right-click the mouse on it and select Insert Method from the pop-up menu.

For a command button such as the one shown in figure 10.1 above, you will be presented with the following pop-up menu listing all of the available methods for this control as follows:

Figure 10.2 The list of methods available for a command button

It is important to note that the list of methods presented will only include methods available for this particular control.

If you select one of these methods such as "Move", a skeletal INVOKE statement will automatically be added to your procedure code such as:

Figure 10.3 A skeletal INVOKE statement for the Move method

The skeletal INVOKE statement is in the proper format and lists both the required and optional (shown in brackets) parameters for this method.

The Move method will move the command button to a new location on the form.

You need to define parameters for the "Left" and "Top" parameters (properties) noted. The top left corner of the control will be placed at the screen coordinates you place into these parameters.

The optional "Width" and "Height" parameters will resize the control at the same time it is moved if specified.

If you do not know the appropriate COBOL data type for any of these parameters, use the Index tab in the on-line help system to look them up.

One important note about the skeletal example shown in Figure 10.3 is to realize that any word (token) that is colored in blue represents a reserved word that you may not use as a data item name.

In the example shown in Figure 10.4 above, "Left" and "Top" are both reserved words and if you attempt to create data items with the same names, you will receive compiler errors at build time.

You would thus want to modify the skeletal example to something valid such as:

Figure 10.4 A valid Move method statement

You should find the method selection lists to be useful in assisting you with choosing valid methods for controls and coding these method invocations correctly.

The same holds true for the property selection lists on the same pop-up menu.