The Listbox Widget

Create a listbox with the Listbox method. You can then insert items into the listbox using the insert method.

$parentwidget->Listbox (options)

The standard configuration options that apply to Listbox are: -background, -bg, -borderwidth, -bd, -cursor, -exportselection, -font, -foreground, -fg, -height, -highlightbackground, -highlightcolor, -highlightthickness, -relief, -select-background, -selectborderwidth, -selectforeground, -takefocus, -width, -xscroll-command, and -yscrollcommand.

Other options are:

-selectmode => mode

Determines the number of items that can be selected at once, as well as key/mouse bindings. mode can be any of:

single

Only one item can be selected at a time.

browse

Only one item can be selected at a time (default).

multiple

Multiple items can be selected at a time.

extended

Multiple items can be selected at a time.

-setgrid => boolean

Turns on gridding for the listbox. If the widget is resized, only complete lines and characters are displayed. Default is 0 (off).

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.