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

Determines the total number of items in PDFFormFieldComboBox or PDFFormFieldListBox

Syntax 3


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

Syntax 3: For PDFFormFieldComboBox and PDFFormFieldListBox objects

Description

Gets the count of item in the object.

Applies to

PDFFormFieldComboBox object

PDFFormFieldListBox object

Syntax

long GetItemCount()

Return value

Long. Returns the count of items if it succeeds, or returns null if otherwise.

Example

The following code example gets the count of items in the PDFFormFieldComboBox object lpdf_combobox.

long ll_count
ll_count = lpdf_combobox.getitemcount()

See also

SetItemList

AddItem

GetItemText

RemoveItem

RemoveAllItem

SetReadOnly

GetReadOnly