Toolbar2000

TTBEditItem

Properties | Events

Description:

Use TTBEditItem to create top-level menus or submenus.

TTBEditItem emulates the appearance and behavior of the edits on MS Office's toolbars.

A key functional difference between a TEdit and a TTBEditItem is the Text property doesn't change in real time as the user modifies the text. Instead, the text is only saved in the Text property once the user presses Enter. (Additionally, an OnAcceptText event is fired when Enter is pressed.) If the user presses Escape, it discards the changes.

Also, by default, TTBEditItem will change into a button when its parent toolbar is docked vertically. This behavior can be disabled by adjusting the EditOptions property (see below).

TTBEditItem inherits many properties, methods, and events from TTBCustomItem; see its help topic for details on the properties, methods, and events not listed here.

Key Properties:

  • property CharCase: TEditCharCase;
    TEditCharCase = (ecNormal, ecUpperCase, ecLowerCase);

    Use CharCase to force the item's text to assume a particular case.
  • property EditCaption: string;
    The caption displayed to the left of the Edit when the item is on a menu.
  • property EditOptions: TTBEditItemOptions default [];
    Miscellaneous options:
    • tboUseEditWhenVertical - When set, the item will remain displayed as an edit instead of a button when the parent toolbar is docked vertically.
  • property EditWidth: Integer default 64;
    The width in pixels of the Edit.
  • property MaxLength: Integer default 0;
    The maximum number of characters the user may enter. If this is 0, no limit is imposed.
  • property Text: string;
    The text.

Key Events:

  • property OnBeginEdit: TTBBeginEditEvent;
    TTBBeginEditEvent = procedure(Sender: TTBEditItem; Viewer: TTBEditItemViewer; EditControl: TEdit) of object;

    When you click a TTBEditItem or press Enter on it, a TEdit control is created on the fly to handle the input. This event occurs after the TEdit control is created. The TEdit control is specified in the EditControl parameter. The code in the event handler may modify the properties of EditControl to customize its appearance, among other things.