NAME

TUI::StdDlg::SortedListBox - list box with automatic item sorting

HIERARCHY

TObject
  TView
    TGroup
      TListBox
        TSortedListBox
          TFileList

SYNOPSIS

use TUI::StdDlg;

my $list = new_TSortedListBox(
  $bounds,
  $scrollBar
);

DESCRIPTION

TSortedListBox is a subclass of TListBox that adds automatic sorting behavior for its items.

The list box maintains its contents in sorted order based on keys extracted from the item text. It is designed as a reusable base class for list views that require ordered presentation, such as file and directory lists.

This class does not define its own construction parameters and relies on the standard TListBox initialization.

ATTRIBUTES

shiftState

Current keyboard shift state used during incremental search and navigation (Int).

CONSTRUCTOR

new

my $list = TSortedListBox->new(
  bounds     => $bounds,
  vScrollBar => $scrollBar | undef
);

Creates a new sorted list box.

This constructor is inherited from TListBox and initializes the view with the specified bounds and optional vertical scroll bar.

bounds

Bounding rectangle defining the position and size of the list box (TRect).

vScrollBar

Optional vertical scroll bar associated with the list box (TScrollBar).

new_TSortedListBox

my $list = new_TSortedListBox($bounds, $scrollBar | undef);

Factory-style constructor using positional arguments.

METHODS

getKey

my $key = $list->getKey($string);

Extracts and returns the sort key used for ordering items.

This method is used internally to determine the relative order of list items and may be overridden by subclasses to customize sorting behavior.

handleEvent

$list->handleEvent($event);

Processes keyboard and command events.

This method extends the inherited list box behavior to support incremental search and navigation within the sorted list.

list

my $collection = $list->list();

Returns the sorted collection backing the list box.

newList

$list->newList($collection);

Assigns a new sorted collection to the list box and refreshes its contents.

SEE ALSO

TUI::Views::ListBox, TUI::StdDlg::FileList

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) 2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).