NAME
TSubMenu - submenu item for menu bars and menu boxes
HIERARCHY
TObject
TMenuItem
TSubMenu
SYNOPSIS
use TUI::Menus;
my $submenu =
new_TSubMenu('~F~ile', kbAltF)
+ new_TMenuItem('~O~pen', cmOpen)
+ new_TMenuItem('~S~ave', cmSave)
+ newLine
+ new_TMenuItem('E~x~it', cmQuit);
DESCRIPTION
TSubMenu represents a submenu entry that can be attached to a menu bar or menu box. It is a specialized form of TMenuItem that owns a list of child menu items.
Submenus are typically constructed using operator chaining, allowing menu structures to be built declaratively.
CONSTRUCTOR
This class does not define its own construction parameters and relies on the standard TMenuItem initialization.
new
my $item = TSubMenu->new(
name => $name,
command => $command,
subMenu => $subMenu,
# optional ..
(
helpCtx => $helpCtx,
next => $next,
)
);
Creates a new submenu item.
- name
-
Text displayed for the menu item (Str).
- command
-
Command identifier (PositiveOrZeroInt). This parameter is optional for submenu entries.
- subMenu
-
Optional submenu associated with this item (Object).
- helpCtx
-
Optional help context identifier (PositiveOrZeroInt).
- next
-
Optional reference to the next menu item (Object).
new_TSubMenu
my $submenu = new_TSubMenu($name, $key, $helpCtx = hcNoContext);
Creates a new submenu item.
- name
-
The displayed submenu name, usually containing a hotkey marker (Str).
- key
-
Keyboard shortcut associated with the submenu (PositiveOrZeroInt).
- helpCtx
-
Optional help context identifier (PositiveOrZeroInt).
METHODS
add
my $submenu = $submenu->add($item | $submenu, | $swap);
Adds a menu item or submenu to this submenu.
This method implements the + operator, allowing menu items to be chained together.
USAGE NOTES
TSubMenu is not normally instantiated directly via new. Instead, the factory function new_TSubMenu should be used.
Menu structures are commonly built using chained additions, which preserves the original Turbo Vision menu construction style.
SEE ALSO
AUTHORS
Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)
COPYRIGHT AND LICENSE
Copyright (c) 1990-1994, 1997 by Borland International
Copyright (c) 2025-2026 the "AUTHORS" as listed above.
This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).