dlgEvent_action_BeforeOpeningTheForm

Function called by relation event before opening the form.

Syntax

PUBLIC FUNCTION dlgEvent_action_BeforeOpeningTheForm( 
   uiMode SMALLINT )

The function has one parameter:

  1. uiMode. This is an integer value defining the current mode or state in relation to user action in the dialog, form, or application. Modes are defined as constants in the libdbappFormUI file in the libdbapp library.
    Table 1. UI modes
    Description Applies to ... Constant Value
    Display DISPLAY ARRAY C_MODE_DISPLAY 1
    Modify INPUT \ INPUT ARRAY C_MODE_MODIFY 2
    Add INPUT \ INPUT ARRAY C_MODE_ADD 3
    Search CONSTRUCT C_MODE_SEARCH 4
    Empty MENU C_MODE_EMPTY 5
    Exit form The form C_MODE_EXIT_FORM 6
    Exit app The app C_MODE_EXIT_APP 7
    Undefined All (array, form, or app) C_MODE_UNDEFINED 0

Usage

When you select the Before Opening The Form property for the creation of the event, a function shell is created. Enter your code in the function.

Use this function to initialize the form, set up toolbars, menus, etc., before opening it. For example, use it to implement variables and to define UI settings.

Example: Before Opening The Form

This example uses the Before Opening The Form code event for a relation to a form in the OfficeStore demo.

In this example, the common_toolbar is set for the form depending on the value of the with_toolbar variable.

PUBLIC FUNCTION dlgEvent__action__BeforeOpeningTheForm(uiMode SMALLINT)
    DEFINE f ui.Form
   
    DISPLAY "dlgEvent__action__BeforeOpeningTheForm (BA Relation scope) is raised"
    DISPLAY "uiMode: ", uiMode
    IF with_toolbar THEN
       CALL f.loadToolBar("common_toolbar")
    END IF
    DISPLAY "dlgEvent__action__BeforeOpeningTheForm (BA Relation scope) is exited"
END FUNCTION