GetItemCount

Determines the total number of items.

To

Use

Determines the total number of items in a ribbon menu.

Syntax 1

Determines the total number of items in PDFTableOfContents or PDFTableOfContentsItem

Syntax 2


Syntax 1: For RibbonMenu control

Description

Determines the total number of items in a ribbon menu.

Applies to

RibbonMenu control

Syntax

controlname.GetItemCount ( { Long ParentIndex } )

Argument

Description

controlname

The name of the RibbonMenu control

ParentIndex

The index of the menu item (RibbonMenuItem) whose submenu items you want to count.

If not specified, the menu item will be counted; if specified to a valid value, the submenu items of the menu item (whose index is ParentIndex) will be counted; if specified to an invalid value, an error would occur and this operation would return -1.


Return value

Long.

Returns the total number of menu items in the menu. If the menu contains no items, returns 0. If an error occurs, returns -1. If any argument's value is null, returns null.

Usage

A RibbonMenu control can contain menu items in no more than two levels.

Examples

This example counts the menu item (which returns 1) and its submenu items (which returns 2).

Long ll_Index, ll_Index2, ll_Count
RibbonMenu lr_Menu

ll_Index = lr_Menu.InsertItemLast ("MenuItem1", "AddSmall!", "Ue_MenuItem1Clicked")
ll_Index2 = lr_Menu.InsertItemLast (ll_Index, "SubMenuItem1", "AddSmall!", "Ue_MenuItem11Clicked")
ll_Index2 = lr_Menu.InsertItemLast (ll_Index, "SubMenuItem2", "AddSmall!", "Ue_MenuItem12Clicked")
ll_Count = lr_Menu.GetItemCount (ll_Index)
ll_Count = lr_Menu.GetItemCount ()

See also

AddSeparatorItem

DeleteItem

GetItem

InsertItem

InsertItemFirst

InsertItemLast

SetItem

Syntax 2: For PDFTableOfContents and PDFTableOfContentsItem objects

Description

Gets the count of items in the table of contents.

Applies to

PDFTableOfContents objects

PDFTableOfContentsItem objects

Syntax

long GetItemCount()

Return value

Long. If calling the function for the PDFTableOfContents object, returns the count of items (level-1 chapters) in the table of contents. If calling the function for a PDFTableOfContentsItem object, returns the count of sub-level items in the PDFTableOfContentsItem.

Example

The following example gets the count of items (level-1 chapters) in the table of contents.

Long ll_count
ll_count = lpdf_toc.getitemcount( )

See also

AddItem

GetBottomMargin

GetFont

GetItem

GetLeftMargin

GetPosByPageIndex

GetRightMargin

GetStyle

GetTitle

GetTopMargin

RemoveAll

RemoveItem

SetBottomMargin

SetFont

SetLeftMargin

SetPosByPageIndex

SetRightMargin

SetStyle

SetTitle

SetTopMargin