2 Eloquence ASCII Windows

Dialog Resource File

A Dialog Resource file can be loaded using DLG LOAD. This is a normal HP-UX text file in a simple format:

Class ObjectName {
   .Attribute = value
   .Attribute = "String"

   Class ObjectName {
      .Attribute = value
      ...
   }

   ...
}

...

Class defines the object class.

ObjectName defines the name of the object.

.Attribute defines the characteristic of the object.

After the file has been analyzed, the objects are defined internally with DLG NEW and DLG SET.

Example

dialog Dialog1 {
   .x = 1
   .y = 1
   .w = 50
   .h = 12
   .title = " Dialog1 "
   .f4 = 1

   groupbox box1 {
      .x = 2
      .y = 2
      .w = 20
      .h = 5
      .title = " box1 "

      radiobutton r1 {
         .x = 1
         .y = 1
         .text = "Radio 1"
      }

      radiobutton r2 {
         .x = 1
         .y = 2
         .text = "Radio 2"
      }
   }

   groupbox box2 {
      .x = 25
      .y = 2
      .w = 20
      .h = 5
      .title = " box2 "

      radiobutton r1 {
         .x = 1
         .y = 1
         .text = "Radio 1"
      }

      radiobutton r2 {
         .x = 1
         .y = 2
         .text = "Radio 2"
      }
   }

   pushbutton ok {
      .x = 2
      .y = 10
      .text = " DONE "
      .rule = 1
   }
}

The include directive

The include directive makes it possible to have common definitions among dialog files (including context specific definitions).

   include "file"
This will include the given file. If a relative path is specified, the include file is loaded relative to the path, the current dialog file is loaded from.

The file name may also contain environment variables. Environment variables are expanded in order to locate the file.

For example:

   include "$HOME/sample.inc"
will include the file sample.inc from the home directory.

   include "sample.inc"
will include the file sample.inc from the same directory as the dialog file.

If the first character is a question mark ('?'), DLG LOAD will not fail if the include file is not present.

For example:

   include "?$HOME/sample.inc"
will try to include the file sample.inc from the home directory.

Include file nesting is limited to two levels.

The define directive

The define directive makes it possible to use Variables in the dialog file.

   Name = value
This will associate Name with value. This name may subsequently be used to reference the associated value.

If Name has already been defined, it will be updated with the current value.

For example:

   # border types
   Bd_None    = 0
   Bd_Thin    = 1
   Bd_Thick   = 2
   Bd_shadow  = 3
   Bd_rshadow = 4

   ALT_KEY    = 266
   TITLE      = "Sample string"

   Dialog sample {
      ...
      .border = Bd_Thick
      .alt = ALT_KEY
      .title = TITLE
      ...
   }

Using Models

You are able to use Models in your dialogs. The dialog description file contains the Model and Dialog description, as two dialogs.

For example:

      Dialog Model {
         ...

         PushButton OK {
            .text = "&OK"
            .rule = 1
         }
         PushButton HELP {
            .text = "&HELP"
            .rule = -1
         }
      }

      Dialog Sample {
         ...

         Model.OK Ok {
            .x = 10
            .y = 10
         }
         Model.HELP Help {
            .x = 20
            .y = 10
         }
      }

The PushButtons "OK" and "Help" will be created in the dialog Sample.

All attributes are derived as specified in the dialog Model.

It's also possible to dynamically create objects from within Eloquence:

DLG NEW "Sample.OK","Model.OK"

This creates the object OK in the dialog sample as specified by the object Model.OK.


Eloquence Dialog Manual - 19 DEC 2002