.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "BrowseEntry 3" .TH BrowseEntry 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::BrowseEntry \- entry widget with popup choices. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Tk::BrowseEntry; \& \& $b = $frame\->BrowseEntry(\-label => "Label", \-variable => \e$var); \& $b\->insert("end", "opt1"); \& $b\->insert("end", "opt2"); \& $b\->insert("end", "opt3"); \& ... \& $b\->pack; .Ve .SH SUPER-CLASS .IX Header "SUPER-CLASS" The \f(CW\*(C`BrowseEntry\*(C'\fR class is derived from the \f(CW\*(C`Frame\*(C'\fR class and inherits all the methods, options and subwidgets of its super-class. By default, options and methods are delegated to the entry subwidget. .SH DESCRIPTION .IX Header "DESCRIPTION" BrowseEntry is a poor man's ComboBox. It may be considered an enhanced version of LabEntry which provides a button to popup the choices of the possible values that the Entry may take. BrowseEntry supports all the options LabEntry supports except \fB\-textvariable\fR. This is replaced by \fB\-variable\fR. Other options that BrowseEntry supports: .IP \fB\-arrowimage\fR 4 .IX Item "-arrowimage" Specifies the image to be used in the arrow button beside the entry widget. The default is an downward arrow image in the file cbxarrow.xbm .IP \fB\-autolimitheight\fR 4 .IX Item "-autolimitheight" If set to a true value, then the height of the listbox will be at most the number of entries in the list. The overall maximum of \&\f(CW\*(C`\-listheight\*(C'\fR still applies. .IP \fB\-autolistwidth\fR 4 .IX Item "-autolistwidth" If set to a true value, then the width of the listbox will match the width of the largest entry. .IP \fB\-browsecmd\fR 4 .IX Item "-browsecmd" Specifies a function to call when a selection is made in the popped up listbox. It is passed the widget and the text of the entry selected. This function is called after the entry variable has been assigned the value. .IP \fB\-browse2cmd\fR 4 .IX Item "-browse2cmd" Like \f(CW\*(C`\-browsecmd\*(C'\fR, but the callback is called with the listbox index instead of the selected value. .IP \fB\-buttontakefocus\fR 4 .IX Item "-buttontakefocus" Set the \f(CW\*(C`\-takefocus\*(C'\fR option of the button subwidget. .IP \fB\-choices\fR 4 .IX Item "-choices" Specifies the list of choices to pop up. This is a reference to an array of strings specifying the choices. .IP \fB\-colorstate\fR 4 .IX Item "-colorstate" The state of the widget is reflected by color. A non-editable entry widget will get a light gray background, while an editable entry will be almost white. [This may change] .IP \fB\-listcmd\fR 4 .IX Item "-listcmd" Specifies the function to call when the button next to the entry is pressed to popup the choices in the listbox. This is called before popping up the listbox, so can be used to populate the entries in the listbox. .IP \fB\-listheight\fR 4 .IX Item "-listheight" Set the height of the listbox. See also \f(CW\*(C`\-autolimitheight\*(C'\fR. .IP \fB\-listwidth\fR 4 .IX Item "-listwidth" Specifies the width of the popup listbox. .IP \fB\-state\fR 4 .IX Item "-state" Specifies one of three states for the widget: normal, readonly, or disabled. If the widget is disabled then the value may not be changed and the arrow button won't activate. If the widget is readonly, the entry may not be edited, but it may be changed by choosing a value from the popup listbox. normal is the default. .IP \fB\-style\fR 4 .IX Item "-style" Set the "style" of the widget. Permitted values are \f(CW\*(C`MSWin32\*(C'\fR and \&\f(CW\*(C`unix\*(C'\fR. By default \f(CW\*(C`\-style\*(C'\fR is set to the current platform. Widgets with the \f(CW\*(C`unix\*(C'\fR style will look like a normal \f(CW\*(C`BrowseEntry\*(C'\fR widget, whereas with the \f(CW\*(C`MSWin32\*(C'\fR style the arrow will look close to the Windows' standard combobox widget, while moving the mouse the entries will be highlighted, and probably includes other changes. .IP \fB\-variable\fR 4 .IX Item "-variable" Specifies the variable in which the entered value is to be stored. .SH METHODS .IX Header "METHODS" .IP "\fBinsert(\fR\fIindex\fR, \fIstring\fR\fB)\fR" 4 .IX Item "insert(index, string)" Inserts the text of \fIstring\fR at the specified \fIindex\fR. This string then becomes available as one of the choices. .IP "\fBdelete(\fR\fIindex1\fR, \fIindex2\fR\fB)\fR" 4 .IX Item "delete(index1, index2)" Deletes items from \fIindex1\fR to \fIindex2\fR. .IP \fBget\fR 4 .IX Item "get" The get method is delegated to the choices listbox. .SH "ADVERTISED WIDGETS" .IX Header "ADVERTISED WIDGETS" The following widgets are advertised: .IP entry 4 .IX Item "entry" The entry widget. .IP arrow 4 .IX Item "arrow" The button with the arrow image. .IP choices 4 .IX Item "choices" The toplevel widget containing the choice listbox. .IP slistbox 4 .IX Item "slistbox" The scrolled listbox with the choices. .SH SUBCLASSING .IX Header "SUBCLASSING" To make subclassing easier, the following methods may be overridden to use other standard widgets in composing the mega widget: .IP LabEntryWidget 4 .IX Item "LabEntryWidget" A widget class compatible with Tk::LabEntry used for the entry. .IP ButtonWidget 4 .IX Item "ButtonWidget" A widget class compatible with Tk::Button used for the arrow button. .IP ListboxWidget 4 .IX Item "ListboxWidget" A widget class compatible with Tk::Listbox used for the choices listbox. .PP For example to use a \f(CW\*(C`NumEntry\*(C'\fR widget (from the Tk-GBARR CPAN distribution) instead of the normal \f(CW\*(C`Entry\*(C'\fR widget: .PP .Vb 5 \& package Tk::NumBrowseEntry; \& use base qw(Tk::BrowseEntry); \& use Tk::NumEntry; \& Construct Tk::Widget \*(AqNumBrowseEntry\*(Aq; \& sub LabEntryWidget { "NumEntry" } .Ve .SH BUGS .IX Header "BUGS" BrowseEntry should really provide more of the ComboBox options. .SH AUTHOR .IX Header "AUTHOR" \&\fBRajappa Iyer\fR rsi@earthling.net .PP \&\fBChris Dean\fR ctdean@cogit.com made additions. .PP More additions by \fBSlaven Rezic\fR slaven@rezic.de .PP This code was inspired by ComboBox.tcl in Tix4.0 by Ioi Lam and bears more than a passing resemblance to ComboBox code. This may be distributed under the same conditions as Perl.