Skip to content

NumberOfButtons - cToolbar

Returns the number of buttons that are in the toolbar

Type: Function
Return Data Type: Integer

Syntax

Function NumberOfButtons Returns Integer

Call Example

Get NumberOfButtons to IntegerVariable

Description

The NumberOfButtons function returns the number of buttons (that is, cToolbarButton objects) that are in the toolbar.

Although each button is an object, it is described in the internal cCollection object, which you can access through the phoButtons property. This allows you to reference each object via its index.

This sample shows how to enumerate the buttons and show the psLabel of each:

Get NumberOfButtons To icButton
For iButton from 0 To (icButton -1)
    Get ObjectFromIndex of (phoButtons(self)) iButton To hoButton
    Get psLabel of hoButton To sLabel
    ShowLn `Button ` iButton ` has a label of: ` sLabel
Loop

Return Value

The number of buttons that are in the toolbar