| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 5)

Accessing GMS Resources from Outside GMS

In most cases:

However, some situations require G2 code running outside of GMS to access the compiled resource and/or execute a callback procedure. This section shows you how to obtain such access.

Accessing the Compiled Resource

When a callback procedure needs information from a compiled resource, it obtains the information by using gms-get-activation-property, as described under Obtaining Menu Entry Attributes in an Activation Context. Code that runs outside of an activation context cannot use this call, because:

Therefore, GMS provides calls that can obtain information directly from the compiled resource, without the intermediary of an activation path.

To obtain information about properties from the compiled resource:

You can use gms-get-property to display any attribute that is in an object attribute list or table. You cannot use gms-get-property to access information about the dynamically created part of a dynamic menu specification. Such information exists only transiently, and is deleted as soon as GMS no longer needs it.

To obtain information about menu structure from the compiled resource use the procedure gms-return-submenu-entries as described in Obtaining All Cascade Menu Entries.

Executing a Callback Procedure

Using a keyboard accelerator requires G2 to execute the same callback procedure that GMS would execute if the user selected some GMS menu leaf entry. A button or a rule also may have reason to execute a callback procedure.

Such execution requires the callback procedure to receive the standard callback procedure arguments, which only GMS can construct. GMS therefore provides an API call that can execute any callback procedure and provide it with the arguments that it expects.

To execute a callback procedure from code running outside GMS:

You cannot use gms-execute-activation-callback to execute the callback procedure of an entry that is defined in a Reusable Panel template, or in any submenu descended from such a template, because such an entry does not have a unique activation path unless the user has explicitly navigated to it with the mouse.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (3 out of 5)

Copyright © 1997 Gensym Corporation, Inc.