2022 June Release

app.ducx Resource LanguagePermanent link for this heading

The Fabasoft app.ducx resource language of Fabasoft app.ducx allows you to define resources such as string objects, error messages, and symbols. Using the app.ducx resource language, you can create culture- and language-independent solutions as it allows you to avoid hard-coded, culture- and language-specific values in your solution.

A resource model block consists of import declarations and resource model elements. The resources keyword denotes a resource model block. It must be followed by the reference of your software component and curly braces.

Resource model blocks can only be contained in files with a .ducx-rs extension.

Syntax

resources softwarecomponent
{
  // Import declarations
  import softwarecomponent;

  // Resource model elements (symbols, strings, error messages)
  ...
}

Defining StringsPermanent link for this heading

Multilingual strings can be stored in instances of object class String (COOSYSTEM@1.1:String).

Syntax

string reference;

The string keyword is used to define a string object. The actual text that is stored in the string object is defined like any other multilingual string in Fabasoft app.ducx. Please refer to chapter “Multilingual Strings” for more information on how to enter multilingual strings in Fabasoft app.ducx.

The main purpose of string objects is to be used for defining the label text of branches in dialogs of virtual applications.

Most dialogs, for instance, have a “Cancel“ branch for aborting the virtual application. In order to avoid having to enter the string “Cancel” for each “Cancel“ branch, you simply define a string object holding the string “Cancel”, and reuse it for each “Cancel“ branch.

For detailed information on virtual applications, please refer to chapter “Defining a Virtual Application”.

Example

resources APPDUCXSAMPLE@200.200 {
  import COOSYSTEM@1.1;

  // String object for storing the string "Print Invoice" which is to be
  // used for a branch in a dialog for editing invoice objects

  string StrPrintInvoice;
}

Defining Error MessagesPermanent link for this heading

Syntax

errormsg reference;

The errormsg keyword is used to define a custom error message that you can use when raising exceptions. It must be followed by the reference and a semicolon.

Example

resources APPDUCXSAMPLE@200.200 {
  import COOSYSTEM@1.1;

  errormsg NoInvoiceFound;
}

Defining SymbolsPermanent link for this heading

Syntax

symbol SymbolApprove {
  images<symbolimageformat, content> = {
    {
      SF_VALUE,
      file("filename")
    }
  }
}

The symbol keyword is used to define a symbol. It must be followed by the reference and a block referencing one or more symbol files of different formats and sizes, distinguished by the enumeration property COODESK@1.1:symbolimageformat.

It is suggested to import symbol files to the folder resources/symbols of your app.ducx project. In the example, the binary content of the symbol files referenced in the symbol definition is retrieved from the relative path resources/symbols.

Symbols can be referenced by object classes, branches, toolbar buttons, form pages, and access types.

The enumeration item SF_BMP16 is available for backward compatibility and should not be used any longer. Define at least a 16 x 16 pixels GIF and PNG symbol for the enumeration items SF_GIF16 and SF_PNG16. In some cases, bigger symbols are displayed in the user interface. For these cases the enumeration items SF_PNG20, SF_PNG24, SF_PNG256 and SF_PNG512 are available. If no symbol of the required size is defined, a fallback symbol will be displayed in the user interface.

In this example, two symbols are defined. The symbol files must be imported to the corresponding folder in the Fabasoft app.ducx project.

Example

resources APPDUCXSAMPLE@200.200 {
  import COOSYSTEM@1.1;
  import COODESK@1.1;
  import COOACLEDIT@1.1;

  symbol SymbolPrintInvoice {
    images<symbolimageformat, content> = {
      {
        SF_GIF16,
        file("resources/symbols/PrintInvoice16.gif")
      },
      {
        SF_PNG16,
        file("resources/symbols/PrintInvoice16.png")
      },
      {
        SF_PNG512,
        file("resources/symbols/PrintInvoice512.png")
      }
    }
  }

  symbol SymbolApprove {
    images<symbolimageformat, content> = {
      {
        SF_GIF16,
        file("resources/symbols/Approve16.gif")
      },
      {
        SF_PNG16,
        file("resources/symbols/Approve16.png")
      }
    }
  }
}

Using Variables to Reference FilesPermanent link for this heading

To provide a higher level of flexibility Fabasoft app.ducx variables may be used as part of the file path.

Syntax

file("${<variablename>}/<pathtofilename>.<extension>")

After adding a variable IMAGE_DIRECTORY (defined in Eclipse under “Windows” > “Preferences” > “Fabasoft app.ducx” > “Variables”) containing the path to a directory, the following resource code can be used. Environment variables may be referenced, too.

Example             

resources APPDUCXSAMPLE@200.200 {
  import COOSYSTEM@1.1;
  import COODESK@1.1;
  import COOACLEDIT@1.1;

  symbol SymbolPrintInvoice {
    images<symbolimageformat, content> = {
      {
        SF_GIF16,
        file("${IMAGE_DIRECTORY}/PrintInvoice16.gif")
      }
    }
  }
}