INatAutoSelectedObjects

This document covers the following topics:


Purpose

Collection of the Natural Studio objects that the user has currently selected. Each object is contained only once in the collection, even if the user has selected several visualizations of the same object.

The collection of selected objects can be processed in either of two ways:

  • Through the property SelectedObjects the selected objects can be retrieved as an XML document. This document can then be processed with XML processing functions and statements.

  • The Item method can be used to iterate across the collection in the usual way.

Properties

The following properties are available:

Parent

Used to navigate to the parent interface of this interface.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoObjects) Get only

Studio

Used to navigate to the root interface.

Natural Data Format Variant Type Remark
HANDLE OF OBJECT VT_DISPATCH (INatAutoStudio) Get only

Count

The number of selected objects.

Natural Data Format Variant Type Remark
I4 VT_I4 Get only

SelectedObjects

A string containing an XML document that describes the selected objects. The XML document is structured according to the following DTD:

<?xml version="1.0"?>
<!ELEMENT itemset (sitem*)>
<!ELEMENT sitem(sguid?, stype, skey, sinfo?,
(ntype, nkey, nname?, (nenv | napp)?)?)>
<!ELEMENT sguid (#PCDATA)>
<!ELEMENT stype (#PCDATA)>
<!ELEMENT skey  (#PCDATA)>
<!ELEMENT sinfo (#PCDATA)>
<!ELEMENT ntype (#PCDATA)>
<!ELEMENT nkey  (#PCDATA)>
<!ELEMENT nname (#PCDATA)>
<!ELEMENT nenv  (#PCDATA)>
<!ELEMENT napp  (#PCDATA)>
Element Meaning
sguid The ID of the plug-in that defined the type. Not filled for objects of predefined types.
stype The node type of the object. This can either be a predefined type or a user defined type.
skey The key that identifies the node within its type.
sinfo Additional information that a plug-in may have assigned to the object. Not filled for objects of predefined types.
ntype If the object has been defined by a plug-in, but corresponds to an object of a predefined Natural Studio node type, this property contains the type of the corresponding predefined object.
nkey If the node has been defined by a plug-in, but corresponds to a node of a predefined Natural node type, this element contains the key of the corresponding predefined node.
nname If the object has been defined by a plug-in, but corresponds to an object of the predefined Natural Studio node type subroutine, function or class, this property contains the function name or class name of the corresponding predefined object.
nenv Key of the environment the object belongs to. The key can be used to access the corresponding environment using the method INatAutoEnvironments::Item. If the object belongs to the currently active environment or to an application, the element is empty.
napp Key of the application the object belongs to. The key can be used to access the corresponding application using the method INatAutoApplications::Item. If the object belongs to the currently active application or to no application at all, the element is empty.

Parameters

Natural Data Format Variant Type Remark
A VT_BSTR Get only

FocusObject

The index of the object that currently has the focus.

Natural Data Format Variant Type Remark
I4 VT_I4 Get only

Methods

The following methods are available:

Item

Returns a specific selected object from the collection.

Parameters

Name Natural Data Format Variant Type Remark
Return value HANDLE OF OBJECT VT_DISPATCH (INatAutoSelectedObject)  
Index I4 VT_I4  
Return value

The selected object identified by the value specified in Index.

Index

The index of the selected object in the collection (a value between 1 and Count).

ContainsObjectType

Checks if the current selection contains at least one object of a given type. This quick check is often sufficient to decide if a specific command is applicable to the current selection, without iterating explicitly across the selected objects.

Parameters

Name Natural Data Format Variant Type Remark
Return value BOOL VT_BOOL  
Type I4 VT_I4  
PlugInID A VT_BSTR Optional
Return value

TRUE, if the current selection contains at least one object of the given type.

Type

A predefined or user defined node type.

PlugInID

The global unique ID of the plug-in that defined the type. This is the value of the plug-in's ID property.