Uniface Sample: Menus

Uniface 9.6.01
Sample Version: 1.0
July 2013

Demonstrated Functionality
Files
Knowledge Prerequisites
Environment Dependencies
Steps
More Information



Demonstrated Functionality

This sample demonstrates how to use various aspects and features of Uniface menus.

The sample does not feature any actual functionality, it is just for showing some aspects of the GUI.

Sample Description

The sample consists of a Form that shows either this Readme or a YouTube video on dynamic menus. And it has a menu that shows everything that you can do with Uniface menus.

Screen:

Files

This sample consists of the following files:

File name

Description

u96_menu_readme.html

This file

u96_menu.xml

Uniface export file containing:

Object

Name

Description

Form

U96_MENU

The Form

Library

U96_MENU

Library with Menus, Glyphs, Messages, Global Variables and a Panel

Knowledge Prerequisites

To use this sample, knowledge of the following topics is assumed:

Uniface Subject

Knowledge Level

Uniface development

Basic

Uniface Proc code

Basic

Environment Dependencies

This sample runs only on Microsoft Windows platforms.


Steps

  1. Add the following line as the first line in the [FILES] section of your IDF assignment file.
    u96*.*     .\samples\u96*.*
  2. Create a subfolder samples in your projects folder.
  3. Place the file u96_menu.zip in your samples folder.
  4. Unzip the file u96_menu.zip.
  5. Import the Uniface sources.
    /imp u96_menu.xml
  6. Compile the Uniface sources.
    /all u96_menu*
  7. (Depending on your deployment settings in your .asn file you may need to create a .dol or .uar file.)
  8. Put the following setting in your assignment file:
    $variation = U96_MENU
  9. Run the sample from outside the IDF
    /tst u96_menu
  10. When you run the sample for the first time it will first adjust some settings in the .ini file and exit.
  11. Run the sample again to test the form.
    Browse through all menu options.
    Click on the Panel buttons to switch between this Readme or a Youtube video on dynamic menus.
    Right-click the mouse anywhere in the Form to see the Pop-up Menu.
  12. Examine the Menus and the Form in the Uniface Development Evironment.

Icons in menus

In the menu bar click the Icons menu. You see that it is possible to show an icon in front of a menu item. When switch the style of the sample in the Style menu, the icons in the Icons menu will change.

You can find the code that is used in the Drop-down Menu U96_MENUDROP and in the operation opCreateDropdown of Form U96_MENU.

Fonts, colors and images

In the menu bar click the Styles menu. When you click one of the options your .ini file will be updated and the sample stops. When you start it again you will see different fonts, colors and images.

You can find the code that is used in the Drop-down Menu U96_MENUXXX and in the operation opSetSyle of Form U96_MENU.

A single line of JavaScript is used to dynamically change the HTML background color of the Readme.

Dynamic menus

In the menu bar click the Dynamic menu. You will see a complex dynamic menu that contains several options, cascading dynamic and static menus and an inline static menu.

You can find the code that is used in the PreDisplay trigger of Drop-down Menu U96_MENUCAS and in the operation opCreateDynamic of Form U96_MENU.

Checking, disabling and hiding menu items

In the menu bar click the Status menu. You will see a menu where using the options Check Item, Disable Item and Hide Item you can set the status attributes of Item.

You can find the code that is used in the Drop-down Menu U96_MENUSTAT.

Multilingual menus

In the menu bar click the Language menu. You can choose between English and Dutch.

You can find the code that is used in the Drop-down Menu U96_MENULAN and in the operation opSetLanguage of Form U96_MENU.

All menus have been defined in language USA an language NL. The dynamic menus share the same code for both languages and use Uniface messages defined in both languages to be multilingual.

Keyboard access

Keyboard access can be enabled by access keys. These are the underlined characters in menu items. They are automatically generated in static menus. To overrule that, and in dynamic menus you put a percent sign in front of the character that you want to be the access key.

You can also create accelerators. For a menu item you specify an accelerator with a logical name. In your .ini file you map this to a key comination.

Popup Menu

Right click in the form. The Popup menu will appear.

In the Form Properties U96_MENUPOP is defined as the Pop-up Menu for the Form.

The Popup Menu demonstrates the reuse of menus by only containing a reference to the Dropdown Menu U96_MENU_LAN.

Panels

At the bottom of the form you see a Panel with two buttons. Press the buttons to switch between this Readme file and a YouTube video on Dynamic Menus.

In the Form Properties U96_MENUPANEL is defined as the Panel for the Form. And we have specified that the Panel should appear below the Form.

The buttons call operations opShowVideo and opShowReadme in the operations trigger of Form U96_MENU. The appearance of the panel is changed when you select a style in the Style menu. You can see the code in the opration opSetSyle.

Manipulating the .ini file

This is not specific for menus but used in this sample and it could be useful for your applications.

When you start the sample the code in the Execute trigger of Form U96_MENU checks if this sample has been run before. If not, it will update the .ini file to create the settings that are needed. When you switch Style or Language in the sample it again will update the .ini file. You can find the code that is used in the operations opSetStyle and opSetLanguage of Form U96_Menu.

More information