2.197 .masterapplication[enum]

This attribute defines the assignment of functions that are located directly under a module/dialog to an application object.

Values from the enum range lang_default...lang_java and func_normal...func_data can be used as optional index value.

Definition

  • Data type

    object [ application ]

  • Access

    get, set

  • changed event

    yes

Index Range

lang_default

No programming language is specified in the function definition. The function is implemented in the default programming language C.

lang_c

The function is implemented in the programming language C.

lang_cobol

The function is implemented in the programming language COBOL.

lang_cobol_cancel

The function is implemented in the COBOL programming language and is called using a CANCEL statement.

lang_fortran (obsolete)

The function is implemented in the programming language Fortran.

lang_java (obsolete)

The function is implemented in the programming language Java.

lang_pascal (obsolete)

The function is implemented in the programming language Pascal.

func_callback (internal)

The function is an object callback function that can be assigned to an object in its .function attribute and is called for defined events.

Keyword in the function definition: callback.

func_canvas (internal)

The function is a canvas function that can be assigned to a canvas object in its .canvasfunc attribute.

Keyword in the function definition: canvasfunc.

func_content (internal)

The function is a reloading function that can be assigned to a tablefield in its .contentfunc attribute.

Keyword in the function definition: contentfunc.

func_data (internal)

The function is a data function that can be assigned to objects in their .datamodel attribute and is called by the IDM when synchronizing the model and view components.

Keyword in the function definition: datafunc.

func_format (internal)

The function is a format function that can be assigned to the objects edittext and tablefield in their .formatfunc attribute.

Keyword in the function definition: formatfunc.

func_normal (internal)

The function is a normal application function that can be called from the Rule Language.

func_spinbox (internal)

The function is used to control the displayed value of a spinbox with .style = void from the application and can be assigned to the spinbox in its .spinfunc attribute.

Keyword in the function definition: spinfunc.

When calling a module function, the assignment to an application is searched for in the .masterapplication[] attribute of the module. This is done according to the specified language definition, the function type or even without any typing at all (without index specification). This application assignment is then used to determine the function connection and thus call the function accordingly. If no assignment has been defined at the module, the search is performed at the dialog. A definition to null prevents the search at the dialog.

The .masterapplication attribute was introduced for IDM version A.06.02.m to allow assignment of module functions in a similar way to the .application attribute on the import object.

Example

Modularized dialog with the functions in the module Functions.mod, where COBOL functions are attached to the server application ApplServer and all other functions to the dynlib application ApplLocal.

// Dialog.dlg
dialog Dlg
{
  .masterapplication ApplLocal;
}

application ApplLocal {
  .transport "dynlib";
  .exec "libusercheck.so";
  .active true;
}

use Functions;

on dialog start
{
  variable string Username := setup.env["USER"];
  if  ValidateUser(Username) then
    print "Age = "+GetAge(Username);
  endif
  exit();
}
// Functions.mod
module Functions
{
   .masterapplication[lang_cobol] ApplServer;
}

use Server;

record RecUser
{
  string[50] FirstName;
  string[50] LastName;
  integer Age;
}

export function boolean ValidateUser(string Username);
function cobol integer GetUserProfile(string[50] Username,
                                      record RecUser output);

export rule integer GetAge(string Username)
{
  if GetUserProfile(Username, RecUser)>0 then
    return RecUser.Age;
  endif
  return 0;
}
// Server.mod
module Server

export application ApplServer {
  .connect "server:4712";
  .active true;
}

Availability

Since IDM version A.06.02.m

See also

Attribute .application

Chapter “Modularization” in manual “Programming Techniques”