2.47 :use()

This method imports a new module into a dialog or module object from its Use Path. This allows to include the module in a similar way as with a static use statement, so that the module is loaded only once in the dialog.

If the Check parameter is set to true during the call, it is only tested whether an import with use already exists on this object.

Definition

object :use
(
      string  Usepath input
  { , boolean Export  := false input
  { , boolean Check   := false input } }
)

Parameters

string Usepath input
This parameter is used to specify the module as a Use Path (in the form of an identifier path).
boolean Export := false input

If this optional parameter is true, the use is additionally flagged as exported upon creation (default value false).

The parameter is only relevant when Check = false.

boolean Check := false input
If this optional parameter is true, it is only tested whether the module given by the Use Path has already been imported with use (default value false).

Return value

null

With Check = false:

Module could not be found or loaded.

With Check = true:

No use exists for this Use Path.

<Id>
Id of the imported module.

Objects with this method

Example

window Wi
{
  edittext EtUsepath
  {
    .xauto 0;
    .content "Plugins.View.CustomerModels";
  }

  pushbutton PbUse
  {
    .yauto -1;
    .text "Use";

    on select
    {
      if this.module:use(EtUsepath.content, false, true) = null then
        if this.module:use(EtUsepath.content) = null then
          print "Can't import module!";
        endif
      endif
    }
  }
}

Availability

Since IDM version A.06.02.g

See also

Method :unuse()

Chapters “The Alternative Import Mechanism” and “Language Specification and Use Path” in manual “Programming Techniques”