15 import

The use of a module in another module or dialog is started with the keyword import.

The keyword is followed by the logical name of the module. The logical name usually is not the name of the module itself. Sometimes it is even possible to use one and the same module with different logical names in a module although this can be described in a better and more elegant way by using models. The logical name of the imported module is followed by a string bearing the name of the interface file.

Definition

{ export | reexport } import { <Identifier> } "<filename>"
{
  object-specific attributes>
}

See also

For further information please read about the object module or refer to chapter “Modularization” of manual “Programming Techniques”.

Events

none

Children

document

record

transformer

Parent

dialog

module

Menu

none

15.1 Attributes

Attribute

RLD

PID

Properties

Short Description

.application

application

application

S,G/D/C

functions of the module to be loaded are to be linked to this application

.document[integer]

object

document

S,G/-/-

accesses the I-th XML Document

.external

boolean

boolean

-,G/-/-

returns if the object class is an USW class

.external[integer]

class

class

-,G/-/-

returns the I-th registered USW class

.firstrecord

object

record

S,G/-/C

accesses the first record of an object

.index

integer

integer

-,G/-/-

current index of object in the children list of its parent

.lastrecord

object

record

S,G/-/C

accesses the last record of an object

.load

boolean

boolean

S,G/D/C

loading state of the module

.record[integer]

object

record

S,G/-/C

accesses the I-th record of an object

.recordcount

integer

integer

-,G/-/-

queries the number of child records

.static

boolean

boolean

S,G/D/C

module can be unloaded

15.2 Specific Attributes

A module can be loaded into another module in different ways. Loading here implies that not only the object names but also their definitions are known to the module and can thus be displayed and changed. Internally there are three different kinds of loading some of which are already determined by the objects defined or exported in the module.

Example

module Modul

import Colors "color.if";

 

window W

{

  .bgc Green;           // load on use

}

on W focus

{

  this.bgc := Red;      // implicit load

}

on W select

{

  Colors.load := true;  // explicit load

}

Load on use is preferred to the other loading types. Implicit load is preferred to explicit load. In the example above load on use is carried out, i.e. the other types have no effect any longer as the module is already in the memory and the rules can be executed directly.

Explicit load can be specified as attribute already at the import.

module Modul

import Colors "color.if"

{

  .load true;  // explicit load

}

15.3 Example

!! Interfacefile: module.if

module Module

export import StandardColor "color.if";

...

import Colors "PRIVLIB:mycolor.if";

  // The file mycolor.if is only searched

  // in the path PRIVLIB