Steps to make a DLG-Application:
2. Use DLG-options to Fine-tune Components

From the first part of this article series you know already how to break the functionality of a target application down to existing DLG-components and to "plug together" an application framework by combining these components. But how can you to fine-tune their layout and/or behavior?

The second step after "plugging together" an Application Framework is:

Use the components' options to fine-tune their layout and/or behavior.

An "option" is a combination "<keyword>=<value>" to override the DLG defaults. Any number of options can be strung together in a plain-text string, with at least one whitespace character in between. Consequently the value must be enclosed by single-apostrophe brackets ' ' if it holds significant whitespace characters. The order of options is not relevant, except in a few cases that are pointed out in the documentation. Exact coding is required only for:

  • keyword must be spelled correctly
  • format specifier must be right.

For details see the preceding articles.

An option that is incorrectly coded is simply ignored. Normally this has no further consequence.

Once an Application Framework is "plugged together", it has about the same look-and-feel as you might expect of a conventionally programmed application. In the default-state of DLG the dialog box and Static, Button and Slider components have gray background, the background of all the other standard components is white. All text is printed in the standard system font. All components behave in the usual way.

Yet, with DLG you can make your applications have a wide range of layout and behavior, by coding options. For example:

Color: You can have any foreground and background color that is possible with the 24bit-RGB-colors. You just need an option "Color=%x",rgb or "BkColor=%x",rgb ( rgb ... variable holding color value). If rgb is a constant value, you can code it also as "Color=rgb" or "BkColor=rgb" ( rgb ... hexadecimal number: color value)

Brush: A brush can be used only for backgrounds. The option to do it is "BkBrush=%x",brush. The value brush is a variable (type HBRUSH) - the handle of the respective brush.

Pattern: A pattern can be used only for backgrounds. The option to do it is "BkPattern=*%s",pattern or "BkPattern=*%s",pattern. (pattern ... string holding name of resource declaration, or path to .bmp-file). Or, for constants, "BkPattern=*<pattern>" or "BkPattern=#<pattern>" (pattern ... character sequence: name of resource declaration, or path to .bmp-file).

Note the prefixes: *<pattern>; means, the bitmap determining the pattern is to be taken from a resource declaration in the application's .rc-file. #<pattern> means, the bitmap will be extracted from a bitmap file (.bmp).

Font: The lettering of any UIF-element (i.e. control, menu item) can be in any font that is available in the user's system (sub-directory WINDOWS\FONTS or WINNT\FONTS ). Thus there can be different fonts in a dialog at the same time (impossible in conventional programming!)

Size: The letter size in which a text will be printed in can be varied by option "Size=%d",size. The format specifier is %d. So a constant letter size can be written simply in decimal numbers, e.g. "Size=12". As with different fonts, also different letter sizes can occur in a dialog at the same time.

You can use this flexibility of DLG, for example, to cram many items into a list. If you provide subtitles in a different letter size (and perhaps another font), it is still perceived as not overcrowded.

Just a few option examples could be given here. There are many other options, specific to each UIF-element. In particular they are needed to control exactly the behavior in reaction to user inputs by mouse and/or keyboard. Comprehensively they are described in the documentation coming when you download a DLG package comprising that UIF-element.