EPLAN.EPLAN21.FORMGENDLG.GENERATE

Contents

Description

The command opens the dialog for generating forms. For a description of the functionality provided in this dialog, please refer to the documentation of the commands EPLAN.EPLAN21.FORMGEN.GENERATE_PAGE and EPLAN.EPLAN21.FORMGEN.GENERATE_FILE.

Parameters

The following parameters have the EPL_PARAM_COMMAND_ prefix.

ParameterID Type Description
PARENTWINDOW [IN]
HWND (integer)
Window handle of the dialog out of which the command is called up.

The following parameters have the EPL_PARAM_FORMGENDLG_GENERATE_ prefix.

ParameterID Type Description
PROJECT [IN]
EplHandle
Handle to the project for which the form generator is to be started.
PAGE [IN, OPTIONAL]
EplHandle
The handle to the page is needed, when the dialog is to be defaulted with values. Form and type of the report to be generated are defaulted in accordance with the selected page.
ALLOWCREATEINSTANCE [IN, OPTIONAL]
Boolean
With this parameter you can specify whether the generation of instances is permitted (unequal 0), or not (0). This avoids that for example instances are generated from the browser when the dialog is called up .
DOSTARTINTERACTION [OUT]
Boolean
Indicates whether instances were generated with the form generator, that can be placed on the page through an interaction (value unequal 0).
INSTANCES [OUT]
EplHandle
Handle to an iterator containing the generated instances. The handle to the iterator must be released with eplCloseObject when the parameter was read from the command with eplGetHandleParam.

Error Messages

The eplExecuteCommand function returns EPL_OK if the dialog could be successfully opened.

If the command fails, eplExecuteCommand returns the value EPL_ERROR. In this case, the error log can contain the following errors:

ErrorID Description
EPL_ERR_NO_RIGHT The current user group is not allowed to open the dialog.
EPL_ERR_FAILED The dialog could not be opened.

Example

The following example shows a function that opens the dialog for the form generator. The instances generated by the form generator can be read from the returned iterator and can be used further on.

void
openFormGenDlg(EplSession hSession, EplHandle hProject, EplHandle hPage)
{
        // Generate a command for starting the FormGen dialog:
        EplHandle hFormGenCmd = eplCreateCommand(hSession,
                                                 L"EPLAN.EPLAN21.FORMGENDLG.GENERATE");

        // Transfer the ParentWindow:
        HWND hwnd = getDlg()->getPeer();
        EplChar buf[20];
        _ltow((long)hwnd, buf, 10);
        eplSetParam(hSession,
                    hFormGenCmd,
                    EPL_PARAM_COMMAND_PARENTWINDOW,
                    buf,
                    0);

        eplSetHandleParam(hSession,
                          hFormGenCmd,
                          EPL_PARAM_FORMGENDLG_GENERATE_PROJECT,
                          hProject,
                          0);

        eplSetParam(hSession,
                    hFormGenCmd,
                    EPL_PARAM_FORMGENDLG_GENERATE_ALLOWCREATEINSTANCE,
                    L"1",
                    0);

        eplSetHandleParam(hSession,
                          hFormGenCmd,
                          EPL_PARAM_FORMGENDLG_GENERATE_PAGE,
                          hPage,
                          0);

        // Start the dialog:
        eplExecuteCommand(hSession, hFormGenCmd);

        buf[0] = L'\0';
        eplGetParam(hSession,
                    hFormGenCmd,
                    EPL_PARAM_FORMGENDLG_GENERATE_DOSTARTINTERACTION,
                    0,
                    buf,
                    19);

        if (0 != wcstol(buf, NULL, 10))
        {
                EplHandle hInstList = eplGetHandleParam(hSession,
                                                        hFormGenCmd,
                                                        EPL_PARAM_FORMGENDLG_GENERATE_INSTANCES,
                                                        0);
                EplHandle hInst = eplFirst(hSession, hInstList);
                while(hInst != EPL_ERROR)
                {

                        doSomethingWithInstance(hSession, hInst);

                        hInst = eplNext(hSession, hInstList);
                }

                eplCloseObject(hSession, hInst);
        }

        // Clear a bit up:
        if(hPage != EPL_ERROR)
                eplCloseObject(hSession, hPage);
        eplCloseObject(hSession, hProject);
        eplCloseObject(hSession, hFormGenCmd);
}

Reference