Partager via


IVsObjectList.GetCategoryField Method

Returns the value for the specified category for the given list item.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Déclaration
Function GetCategoryField ( _
    index As UInteger, _
    Category As LIB_CATEGORY, _
    <OutAttribute> ByRef pField As UInteger _
) As Integer
'Utilisation
Dim instance As IVsObjectList
Dim index As UInteger
Dim Category As LIB_CATEGORY
Dim pField As UInteger
Dim returnValue As Integer

returnValue = instance.GetCategoryField(index, _
    Category, pField)
int GetCategoryField(
    uint index,
    LIB_CATEGORY Category,
    out uint pField
)
int GetCategoryField(
    [InAttribute] unsigned int index, 
    [InAttribute] LIB_CATEGORY Category, 
    [OutAttribute] unsigned int% pField
)
function GetCategoryField(
    index : uint, 
    Category : LIB_CATEGORY, 
    pField : uint
) : int

Parameters

  • index
    Type: System.UInt32

    [in] Specifies the index of the list item of interest.

  • pField
    Type: System.UInt32%

    [out] Pointer to a variable holding the value returned.

Return Value

Type: System.Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::GetCategoryField(
   [in] ULONG Index,
   [in] LIB_CATEGORY Category,
   [out,retval] DWORD* pField
);

The environment's object manager calls this method to retrieve the category data for the list items. You must return in the pField parameter an enumerator value from the LIB_* enums corresponding to the category specified in the Category parameter. The categories and their associated field enumerations are listed in the following table.

Category from LIB_CATEGORY

LIBCAT_ enum

LC_MEMBERTYPE

_LIBCAT_MEMBERTYPE

LC_MEMBERACCESS

_LIBCAT_MEMBERACCESS

LC_CLASSTYPE

_LIBCAT_CLASSTYPE

LC_CLASSACCESS

_LIBCAT_CLASSACCESS

LC_ACTIVEPROJECT

Unused.

LC_LISTTYPE (Special, see below)

LIBCAT_LISTTYPE (typedef of _LIB_LISTTYPE)

LC_VISIBILITY

_LIBCAT_VISIBILITY

LC_MODIFIER

_LIBCAT_MODIFIERTYPE

LC_NODETYPE (Special, see below)

_LIBCAT_NODETYPE

If the index parameter is NULINDEX, Category will be LC_LISTTYPE and the request is for the list as a whole, not a specific list item. This is asking for the child list types supported under this list. In this case you would assign pField one or more of the values from the _LIB_LISTTYPE enumeration. For instance, an LLT_CLASSES list may return LLT_CLASSES | LLT_MEMBERS to indicate that it supports classes and member lists. This does not, however, mean that every list item in this list supports both child lists.

Calling the GetCategoryField method with LC_LISTTYPE category is one way the environment determines if a node is expandable so it can indicate that a '+' symbol should be displayed in the object browser or class view tools. Since computing expandability of a node can be expensive for your library, the environment will first call GetExpandable. If that method fails, the environment will call GetCategoryField. Use GetExpandable2 if you can determine the expandable state of the list item much faster than fully enumerating all the supported lists under the given item.

Do not implement LC_NODETYPE for non-LLT_HIERARCHY lists. You can return LCNT_SYMBOL for LLT_HIERARCHY lists that are actually symbol lists, however.

Permissions

See Also

Reference

IVsObjectList Interface

IVsObjectList Members

Microsoft.VisualStudio.Shell.Interop Namespace