dlgEvent_OnExec

Function called to open custom form.

Syntax

PUBLIC FUNCTION dlgEvent_OnExec( 
   p_whereRelation STRING,
   p_uiSettings UISettings_Type)
RETURNS (INTEGER, SMALLINT)

The function has two parameters:

  1. p_whereRelation. This is a string defining the WHERE clause specified by the entity relation in the BA diagram.
  2. p_uiSettings. This is RECORD type containing the UI Settings defined on the relation for the form. The type is defined in the libdbappFormUI file in the libdbapp library.
Returns values:
  1. An integer is returned with the SQLCA.SQLCODE error number. Codes are defined as constants in the libdbappSql and libdbappCore libraries.
  2. A SMALLINT value is returned. It defines the type of user action for the form. Actions are defined as constants in the libdbappFormUI file in the libdbapp library.

Usage

When you select the On Exec property for the creation of the event, a function shell is created. Enter your code in the function.

This function is called to perform the function of opening the form. You can add code to this function to perform or modify actions for a custom form.

Examine the demo applications for examples of custom code use:
  • In the OfficeStore demo, the OrderLoginCustomForm form provides an example of a custom form implementing a login.
  • In the OfficeStoreMobile demo, the AccountSplash form provides an example of a custom form implementing a splash screen.
Open these forms from the BA diagram. Under Dialog Events look for the On Exec property, and click on the arrow to get to the example code.

Example: On Exec

This example uses the On Exec event for the OrderLoginCustomForm form in the OfficeStore demo.

In this example, the function is called to initialize a login form. A window is opened with the form and a MENU dialog is created for the user to close the form.

PUBLIC FUNCTION dlgEvent_OnExec(p_whereRelation STRING, p_uiSettings UISettings_Type) RETURNS (INTEGER, SMALLINT)
    DEFINE errNo INTEGER
    DEFINE actionNo SMALLINT

    DISPLAY "dlgEvent_OnExec (Form scope) is raised"
    --Sample user code
    
    OPEN WINDOW w_OrderLoginCustomForm WITH FORM 'OrderLoginCustomForm'
    MENU
        ON ACTION close EXIT MENU
    END MENU
    CLOSE WINDOW w_OrderLoginCustomForm

    RETURN errNo, actionNo
END FUNCTION