Enabling Microsoft's Visual Styles in Dialog System Applications

Applications created with Dialog System might look quite dated in contemporary environments. Visual COBOL supports the Windows visual styles and the use of the system fonts which, when enabled in your Dialog System applications, give them a modern look that is native and consistent with the Windows Operating System the applications are running on.

Windows visual styles are a set of customizations that define the appearance of common controls and are directly related to the theme selected in your Windows OS. When an application uses the visual styles, the appearance of its common controls changes to match the look and feel of the theme selected in the Windows OS that the application is running on.

When the visual styles are enabled in Dialog System applications, any Dialog System controls or controls created using the GUI Class Library are displayed using the current visual styles. This does not affect any third-party controls and they appear as before.

GUID-3B0AC2EE-5341-4AB2-9084-AE51626EA307-low.png

The visual styles are not applied by default and must be enabled within your application.

You can enable the visual styles in Dialog System applications in one of the following ways:

Note: Visual COBOL comes with a project template, Dialog System Application (Modern), that includes the manifest file. This applies the visual styles to new Dialog System applications by default.

You can enable the visual style fonts within your applications in one of the following ways:

Note: You can set MFVSSW to both /c /f.

In addition, configuration options for enabling the visual styles and fonts are available in the Dialog System painter. When these options are selected, the painter and the screensets you edit are using the fonts and the appearance of the common controls of the selected Windows theme:

GUID-58977BA5-E29C-4446-B69F-296175D35E79-low.png

Important: When the common controls are using the visual styles and fonts, a number of them have different behavior or appearance in different versions of Windows. This might result in changing the size and positioning of controls and in UI inconsistency of your applications between different versions of Windows. Micro Focus recommends that you test your applications in different versions of Windows to ensure that the controls and fonts used by the applications always display as expected.

See Changes to Existing Dialog System Applications that Use the Visual Styles in this product Help for information about some of the expected changes when the visual styles and the system fonts are used.

Enabling the visual styles in Dialog System applications

Visual COBOL includes some project templates for creating Dialog System applications. The Dialog System Application (Modern) project template has the visual styles enabled by default.

For existing Dialog System applications, you need to enable the visual styles manually as follows:

  • Add the MFVSSW environment variable to your application and set it to a value of /c.

    You can set the variable by adding an application configuration file to your project and setting the variable in it, or by specifying the variable in the environment.

    This only applies the visual styles to controls created by Dialog System and the GUI class library.

Alternatively, to enable the visual styles for applications that compile to an executable, add a manifest file to the project that contains the required version of the common controls:

  1. In Visual COBOL, open the project for your Dialog System application.
  2. Right-click the project in Solution Explorer, and click Add > New Item.
  3. Select Application Manifest from the COBOL Items group, and click Add.
  4. Rebuild your application to apply the visual styles.

    Using the manifest applies the visual styles to all controls - both those created by Dialog System and the GUI class library and also to any third-party controls.

Enabling the visual style fonts in Dialog System applications

Add the MFVSSW environment variable to your application and set it to /f. This makes the application use the font used for Windows messages as the default font.

You can set the variable by adding an application configuration file to your project and setting the variable, or by specifying the variable in the environment.

Enabling visual styles in the Dialog System painter

You can configure the Dialog System painter to use the visual styles controls and the default system fonts used by the Windows version you are running the painter on. To do this:

  1. In Dialog System, click Options > Configuration > Defaults.
  2. Select VISUAL STYLE CONTROLS and set this to Yes.
  3. Select VISUAL STYLE FONTS and set this to Yes.
  4. Restart Dialog System.

    Dialog System launches using the new visual styles and fonts.

Alternatively, if starting Dialog System painter from the command line, also set MFVSSW to launch the painter with the visual styles.

Changes in Behavior

When the visual styles and fonts are enabled, the appearance and size of the common controls windows might vary on different Windows operating system and with different visual styles. As a result of this, when you apply the visual styles and fonts to existing Dialog System applications, the UI might be inconsistent on different Windows versions:

  • Windows could appear to be of a different size.
  • Some controls could overlap.
  • Controls that use the fit text option could be either too big or too small for the size of the text.
  • The default size of sections of a control (such as the list view column size or the status bar area) might be too big or too small for the information these controls hold.
  • The default window background color is based on the visual styles setting.
  • Clipped child windows continue to have rounded borders despite the top-level windows no longer having them.
  • When an application is using the visual styles, the Dialog System run-time does not apply 3D-borders to its controls.
  • In Dialog System painter, the display fields background color is based on the visual styles setting.
  • The screen control icons in the Icon palette toolbar of the Dialog System painter represent the controls to be added to screensets. They are not affected when you enable the visual styles in the painter and preserve their 3D appearance.
  • It is not possible to set the foreground color on radio buttons and check boxes.

See Changes to Existing Dialog System Applications that Use the Visual Styles in this product Help for information about some of the expected changes when the visual styles and the system fonts are used.