Toolbar2000

TTBCustomItem

Properties | Methods | Events

Description:

This is the base component which all other Toolbar2000 items inherit from.

Key Properties:

  • property AutoCheck: Boolean default False; When True, the item's Checked state toggles automatically when it is clicked, before any OnClick event is fired.
  • property Caption: string;
    The item's caption. Whether it is displayed or not depends on the setting of the DisplayMode and Options properties, and whether the item is on a menu or a toolbar.
    Regardless of whether the caption is displayed it is always made available to MSAA clients, so it is a good idea to set Caption on every item you create (with the exception of separators).
  • property Checked: Boolean;
    When True, the button or menu item is drawn has a "down" or "checked" appearance. This property is similar to TMenuItem.Checked and TSpeedButton.Down.
  • property Count: Integer;
    (Run-time only) The number of subitems the item has.
  • property DisplayMode: TTBItemDisplayMode default nbdmDefault;
    TTBItemDisplayMode = (nbdmDefault, nbdmTextOnly, nbdmTextOnlyInMenus, nbdmImageAndText);

    Determines whether the item's image is to be displayed. nbdmDefault means show both the image and text in menus, but only an image on toolbars. nbdmTextOnly means never show an image. nbdmTextOnlyInMenus means never show an image if the item is on a menu. nbdmImageAndText means always show the image.
  • property EffectiveOptions: TTBItemOptions;
    (Run-time only) The effective Options for the item; that is, the Options after having been combined with inherited options and masked.
  • property GroupIndex: Integer default 0;
    When GroupIndex is non-zero and True is assigned to the Checked property, all other items with the same parent and GroupIndex setting will have their Checked properties set to False automatically.
    This is similar to TSpeedButton's GroupIndex property.
  • property Hint: string;
    The popup text that is to be displayed when the user rests the mouse cursor over the item. On toolbars, you must set the ShowHint property to True in order to see popup hints on top-level items. To see popup hints on popup menus, you must add tboShowHint to the Options property of the items or one of their ancestors.
    This property works essentially the same as the Hint property used throughout the VCL, but with one Toolbar2000-specific enhancement: if you don't assign a short hint to the Hint property, Toolbar2000 will generate one itself by taking the value of the Caption property and stripping any accelerator keys and any trailing colon or ellipsis from it. However, in the case of TTBSubmenuItem, Toolbar2000 will not generate a hint unless the item has the DropdownCombo property set to True or the item has no visible caption.
    The automatic hint generation may be disabled by setting tboNoAutoHint on the Options property.
  • property InheritOptions: Boolean default True;
    When True, the item will automatically combine its parent's Options with its own Options. Use the MaskOptions property to prevent certain Options from being inherited.
  • property ImageIndex: Integer;
    The image index to use, or -1 if the item has no image.
    By default, when a toolbar item has an image, its Caption is hidden. Set the DisplayMode property to nbdmImageAndText to have it display both the image and caption.
  • property Images: TCustomImageList;
    The image list that holds the image for the item. If Images is nil (i.e. left blank at design time), it will inherit the images from the parent toolbar or menu.
  • property Items[Index: Integer]: TTBCustomItem; default;
    (Run-time only) Use Items to access to a subitem by its position in the list of subitems.
  • property LinkSubitems: TTBCustomItem;
    This property allows you to have the item take its list of subitems from a different item instead of from itself. By using this property, you could have several TTBSubmenuItems sharing the same set of subitems.
  • property MaskOptions: TTBItemOptions default [];
    Determines which Options will not be inherited. Has no effect if InheritOptions is False.
  • property Options: TTBItemOptions default [];
    Miscellaneous options:
    • tboDefault - When set, the item's Caption will be displayed in a bold font, and the item will be automatically executed when the parent item is double-clicked. Like TMenuItem's Default property.
    • tboDropdownArrow - When set, TTBSubmenuItems on toolbars will display an arrow on their right side. This option does not change the way the item functions.
    • tboImageAboveCaption - When set, the item's image will be displayed above its caption, similar to default look in older versions of Internet Explorer. This option has no effect if the item is on a popup menu.
    • tboLongHintInMenuOnly - When set, the item's long hint will only be used when in a modal menu loop.
    • tboNoAutoHint - When set, automatic hint generation will be disabled. See the description of the Hint property for more information.
    • tboNoRotation - When set, the item's caption will not be rotated 90 degrees when its parent toolbar is docked vertically.
    • tboSameWidth - When set along with tboImageAboveCaption on two or more items on the same view, the items will be stretched as necessary so that they all have the width in pixels.
    • tboToolbarStyle - When set, the item will be displayed in the style of a toolbar button when on a popup menu: it will have a raised border, the text will be centered, and when Checked the filled pattern will extend across the entire item.
    • tboToolbarSize - When set, the item will be displayed on popup menus with the same size as a toolbar button, and its text will be hidden by default like a toolbar button. Also, consecutive items with tboToolbarSize set will be arranged horizontally like a toolbar.
      In order to set tboToolbarSize, you must first set tboToolbarStyle.
    • tboShowHint - When set, the item can display popup hints when on a popup menu (similar to IE5's Favorites menu). (To enable popup hints on a toolbar, set the toolbar's ShowHint property to True.)
    By default, options set here are inherited by child items. See also the InheritOptions and MaskOptions properties.
  • property ShortCut: TShortCut default 0;
    The keyboard shortcut for the item. Note that the ProcessShortCuts property of the parent toolbar must be set to True for the shortcut to be functional.
  • property SubMenuImages: TCustomImageList;
    The image list that holds the images for the item's subitems. If SubMenuImages is nil (i.e. left blank at design time), it will inherit the images from the parent toolbar or menu.

Key Methods:

Events:

TTBSubmenuItem with the DropdownCombo property set to False (the default), this event will also be fired when the submenu is opened, after the OnPopup event.
  • property OnPopup: TTBPopupEvent;
    TTBPopupEvent = procedure(Sender: TTBCustomItem; FromLink: Boolean) of object;

    Occurs before a submenu is opened. You could use this event to initialize the appearance of the submenu by writing code to add, delete, or modify items.

    If the LinkSubitems property is set, an OnPopup event will be sent first to the item referenced by LinkSubitems. The FromLink parameter will be True in such events.
  • property OnSelect: TTBSelectEvent;
    TTBSelectEvent = procedure(Sender: TTBCustomItem; Viewer: TTBItemViewer; Selecting: Boolean) of object;

    Occurs when the item becomes, or ceases to be, the selected item. Selecting will be True if the item is the selected item, or False if the item is no longer the selected item.