Share via


IVsaGlobalItem.ExposeMembers Property

Sets a value indicating whether the members of the global object should be made available to the script engine. [Not presently supported.]

public: __property bool get_ExposeMembers(); 
public: __property void set_ExposeMembers(bool value);
public bool ExposeMembers {get; set;}
Property Get ExposeMembers() As Boolean 
Public Property Let ExposeMembers(ByVal value As Boolean)

Return Value

Returns TRUE if public members of the global object are available to the script engine without qualification, as if they are part of the global namespace. Returns FALSE if a member of the global object must be qualified with the object's name.

Remarks

[Not presently supported.]

If the value of this property is set to true, then the top-level public members of the object are made available to the script engine as if they were part of the global namespace; otherwise, the members of the object must be qualified with the object's name. That is, when set to true, global members of the object are made available as unqualified identifiers in the user code.

A precondition for reading this property is that the engine must not be closed. Preconditions for setting this property are that the engine must not be closed and the engine must not be running.

The following table shows the exceptions that the ExposeMembers property can throw.

Exception Type

Condition

EngineClosed

The IVsaEngine.Close method has been called and the engine is closed.

EngineRunning

The engine is currently running.

EngineBusy

The engine is currently servicing another thread.

Example

The following example shows how to add a global reference to the Order object to the engine. The Order object has a public, top-level method called CompleteOrder, and is added to the engine as a global object with the name CurrentOrder.

In this first example, the host does not set the ExposeMembers property, and so the user must qualify the call to the CompleteOrder method by means of the CurrentOrder name.

In the host source code, you will find the following code:

// Get a reference to the items collection.
var items : IVsaItems = myEngine.Items;

// Create a new global item, and set its type name.
var glob : IVsaGlobalItem = items.CreateItem("CurrentOrder", 
            APPGLOBAL, 0);

// Set the type string (required), but not the ExposeMembers property.
glob.TypeString = "Order";

In user-supplied code that is added to the engine:

function DoStuff ()
{
// The CompleteOrder call must be qualified.
   CurrentOrder.CompleteOrder();
} 

In this second example, the ExposeMembers flag is specified, so you do not need to qualify the call.

In the host source code:

// Get a reference to the items collection.
var items : IVsaItems = myEngine.Items;

// Create a new global item, and set its type name.
var glob : IVsaGlobalItem = items.CreateItem("CurrentOrder", 
            APPGLOBAL, 0);

// Set the type string (required).
glob.TypeString = "Order";

// Set the ExposeMembers property.
glob.ExposeMembers = true;

In user-supplied code that is added to the engine:

// In the user code, include this:
function DoStuff ()
{
// CompleteOrder can now be called without qualification.
   CompleteOrder();
} 

See Also

Reference

IVsaGlobalItem Interface