Top
PowerCOBOL V11.0 Reference
FUJITSU Software

5.64 OpenForm Method

Description:

Opens (shows) a form in "Modeless" mode.

"Modeless" means that the parent form is active after opening the child form.

It is different from the CallForm2 (CallForm) method in that control is returned to the code immediately after opening the child form.

The child form cannot be re-opened until it is closed.

Used in controls:

None.

Used in objects:

Form

Parameters:

VT_BSTR - FormNameX(8192)

[VT_BSTR - DllNameX(8192)

[VT_I4 - CookieS9(9) COMP-5]

Description of Parameters:

FormName: The name of the form to be opened.

DllName: When the form is a DLL, defines the name of the DLL file containing the form.
It should be omitted when the form is in the same DLL file, as specifying the DLL name that contains the invoking form degrades performance.

Cookie: An integer that distinguishes the opened form.
It is set in a parameter of the CloseChild event when the opened form is closed. If you omit it, the parameter value is zero.

Note that the order of parameters is different from the order of OPENSHEET's parameters.

Return value:

VT_I4 - ReturnValueS9(9) COMP-5

Zero indicates normal completion.
Non-zero indicates an error.

DLL Search Path:

When the DllName Parameter does not contain the full path, PowerCOBOL searches for the DLL in folders in the following order:

1. The folder containing the execution file.
2. The current folder.
3. The system folder of 32 bit Windows.
4. The system folder of 16 bit Windows.
5. The folder containing Windows.
6. The folders set in the PATH environment variable.

Example:

1. To open a form called "Subform1" contained in the same DLL module you would code:

WORKING-STORAGE SECTION.
01 Subform1-ID  PIC S9(9) COMP-5
                          VALUE 1.
PROCEDURE DIVISION.
    INVOKE POW-SELF "OpenForm" 
       USING "SubForm1" 
              Subform1-ID
    SET Subform1-Open TO TRUE

Where Subform1-Open is a global item

2. To open a form called "Subform2" contained in a DLL called "SubForm2.DLL" you would code:

WORKING-STORAGE SECTION.
01 Subform2-ID  PIC S9(9) COMP-5 
                          VALUE 2.
PROCEDURE DIVISION.
    INVOKE POW-SELF "OpenForm" 
      USING "SubForm2" 
            "SubForm2.DLL"
            Subform2-ID

Backward compatibility
method name:

OPENSHEET

Backward compatibility
arguments:

1. X(260) - DLL name
2. X(14) - Sheet name