次の方法で共有


How to: Create Custom Categories of Task Lists

Custom categories of tasks provide control over how tasks are displayed in the Task List window.

Implement a custom category of tasks for the following reasons:

  • You want to control where your categories are displayed (sorted) in the list of categories.

  • You have several subcategories of tasks that you want to sort into one category without other tasks sorting between them.

  • You want to create a custom view in which only your tasks are displayed.

    Note

    You can achieve effects similar to custom categories without actually implementing a custom category. For example, you can display a bitmap for a category or subcategory by implementing ImageList and ImageListIndex. The task provider supplies the list and then each task provides an index into the list.

To create a custom category in the Task List, register it with the Task List by using the following procedure.

To register a custom task list category

  • Call RegisterCustomCategory to register a custom category with the task list.

    Each custom category must have its own GUID, which is specified in the guidCat parameter. In the dwSortOrder parameter, provide the location where you would like this category to sort (when the list is sorted by categories). This method then returns the actual sort placement of the custom category within the larger list of categories.

    Sort orders for the built-in task categories, which are defined in the VSTASKCATEGORY enumeration, are in the following table.

    Category

    Value

    Description

    CAT_ALL

    1

    Not a real category. Used to allow a task list view to show all tasks in the Task List.

    CAT_BUILDCOMPILE

    10

    Build errors, warnings, and possibly deployment errors.

    CAT_COMMENTS

    20

    Tasks generated by special comments, such as "TODO," "UNDONE," or "HACK."

    CAT_CODESENSE

    30

    Errors generated as you type source code.

    CAT_SHORTCUTS

    40

    Shortcuts to code.

    CAT_USER

    50

    Tasks entered by the user.

    CAT_MISC

    60

    Miscellaneous tasks that VSPackages might want to add to the Task List.

    CAT_HTML

    70

    Tasks that pertain to Web page development.

    For example, to include a category between CAT_CODESENSE and CAT_SHORTCUTS, you might pass in a value of 31 for your sort order. However, because a value of 31 might already be used by another custom task category provider, the Task List assigns you the task category for the next empty slot. This value is passed back to you in the pCat parameter.

To unregister a custom task list category

See Also

Concepts

Creating Custom Task List Views