Top
PowerCOBOL V11.0 Reference
FUJITSU Software

5.36 DoModal Method

Description:

Activates the form in "Modal" mode.

It can only be used if the form is already loaded.
"Modal" means that the parent form that opened a child form is inactive until the child form is closed.

It looks like a "Dialog box".

Used in controls:

None.

Used in objects:

Form

Parameters:

None.

Return value:

VT_BOOL - ReturnValueS9(4) COMP-5

POW-TRUE indicates normal completion.
POW-FALSE indicates an error.

Example:

See the DoModal Example

Backward compatibility
method name:

None.

Example of Using the DoModal Method

The following code can be found in the CallActiveX sample, in the WORKING-STORAGE and CallInputFrom scriptlets. It illustrates creating a sub-form as an OLE server and using the DoModal method to activate it in modal state.

 WORKING-STORAGE SECTION.
  01 G-SUBFORM         OBJECT REFERENCE OLE GLOBAL.
  01 G-SUBFORM-OLENAME PIC X(32) VALUE "PowerCOBOL.SampleDialog1.1" GLOBAL.
  :
 PROCEDURE DIVISION.
* Create the subform as an OLE server and activate it in modal state.
* Uses the special *OLE class that provides functions for working
*  with OLE servers.
      INVOKE OLE "CREATE-OBJECT" USING G-SUBFORM-OLENAME RETURNING G-SUBFORM
* Disable the invoking form
      MOVE POW-FALSE TO "Enabled" OF POW-SELF		
* Pass text using the "SetString" custom method
      INVOKE G-SUBFORM "SetString" USING WK-VALUE	
* Open the sub-form in modal mode
      INVOKE G-SUBFORM "DoModal"
* On return enable and activate the invoking form
      MOVE POW-TRUE TO "Enabled" OF POW-SELF
      INVOKE POW-SELF "Activate"