| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (6 out of 12)

Writing a Panel Constructor

The general technique for specifying an entry in a dynamic menu is:

  1. Determine what the entry should consist of.

  2. Use the create action to create an appropriate template object.

  3. Use conclude actions to assign values to template attributes as needed.

  4. Append or insert the element into the template list.

A panel constructor does not have to execute this sequence as a whole for each template: it can define a template list in any order that works. All that matters is that the list contain a complete and correct panel specification when the constructor returns. If the GMS compiler cannot compile a template list, GMS signals an error.


Caution: To avoid unexpected errors in the menu system, write your panel constructor so that it does not enter wait states. Actions that will cause a procedure to enter a wait state are allow other processing, collect data, wait, and do in parallel. Avoid the use of these actions and any procedure which uses them. If there is no alternative, use gms-lock-menus and gms-unlock-menus to lock the menus while the panel constructor is running.

You can include a dynamic template in any menu, including one that was itself defined by a dynamic template, and so on to a maximum of 256 levels. When you nest dynamic templates, GMS does not construct the submenus when it constructs the menu that contains them: it waits until a submenu must be displayed, and constructs it then.

The following procedure is an example of a panel constructor.


Specifying Labels for Templates in Dynamic Panels

If you are using the internationalization features of GFR, you have two options for specifying labels in the templates that are added to the template list in the panel constructor:

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (6 out of 12)

Copyright © 1997 Gensym Corporation, Inc.