Vcl.JumpList.TCustomJumpList.AddCategory

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function AddCategory(const CategoryName: string): Integer;

C++

int __fastcall AddCategory(const System::UnicodeString CategoryName);

Properties

Type Visibility Source Unit Parent
function public
Vcl.JumpList.pas
Vcl.JumpList.hpp
Vcl.JumpList TCustomJumpList

Description

Adds a category to the list of custom categories with the specified category name, and returns the index of the new category in the list.

AddCategory lets you add categories to your list at run time. Use the CustomCategories property to define your categories at design time.

AddCategory makes the Visible property of the new category True.

Windows only shows categories that have items. After you call AddCategory, remember to add at least one item to your list, and then refresh the list if you have not enabled AutoRefresh:

Delphi:

CategoryIndex := JumpLists1.AddCategory('MyCategory');
JumpLists1.AddItemToCategory(CategoryIndex, 'MyItem', '', '', '');
JumpLists1.UpdateList;

C++:

int CategoryIndex = JumpLists1->AddCategory("MyCategory");
JumpLists1->AddItemToCategory(CategoryIndex, "MyItem", "", "", "");
JumpLists1->UpdateList();

This is the result:

JumpListsMyCategoryMyItem.png

You can also specify an empty string as category name. This is the result:

JumpListsEmptyCategoryMyItem.png

See Also