Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  TK::BROWSEENTRY (3)

.ds Aq ’


Tk::BrowseEntry - entry widget with popup choices.



    use Tk::BrowseEntry;

    $b = $frame->BrowseEntry(-label => "Label", -variable => \$var);
    $b->insert("end", "opt1");
    $b->insert("end", "opt2");
    $b->insert("end", "opt3");


The BrowseEntry class is derived from the Frame class and inherits all the methods, options and subwidgets of its super-class. By default, options and methods are delegated to the entry subwidget.


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 <B>-textvariableB>. This is replaced by <B>-variableB>. Other options that BrowseEntry supports:
<B>-arrowimageB> 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
<B>-autolimitheightB> 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 -listheight still applies.
<B>-autolistwidthB> If set to a true value, then the width of the listbox will match the width of the largest entry.
<B>-browsecmdB> 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.
<B>-browse2cmdB> Like -browsecmd, but the callback is called with the listbox index instead of the selected value.
<B>-buttontakefocusB> Set the -takefocus option of the button subwidget.
<B>-choicesB> Specifies the list of choices to pop up. This is a reference to an array of strings specifying the choices.
<B>-colorstateB> 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]
<B>-listcmdB> 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.
<B>-listheightB> Set the height of the listbox. See also -autolimitheight.
<B>-listwidthB> Specifies the width of the popup listbox.
<B>-stateB> 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.
<B>-styleB> Set the style of the widget. Permitted values are MSWin32 and unix. By default -style is set to the current platform. Widgets with the unix style will look like a normal BrowseEntry widget, whereas with the MSWin32 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.
<B>-variableB> Specifies the variable in which the entered value is to be stored.


<B>insert(B>index, string<B>)B> Inserts the text of string at the specified index. This string then becomes available as one of the choices.
<B>delete(B>index1, index2<B>)B> Deletes items from index1 to index2.
<B>getB> The get method is delegated to the choices listbox.


The following widgets are advertised:
entry The entry widget.
arrow The button with the arrow image.
choices The toplevel widget containing the choice listbox.
slistbox The scrolled listbox with the choices.


To make subclassing easier, the following methods may be overridden to use other standard widgets in composing the mega widget:
LabEntryWidget A widget class compatible with Tk::LabEntry used for the entry.
ButtonWidget A widget class compatible with Tk::Button used for the arrow button.
ListboxWidget A widget class compatible with Tk::Listbox used for the choices listbox.
For example to use a NumEntry widget (from the Tk-GBARR CPAN distribution) instead of the normal Entry widget:

    package Tk::NumBrowseEntry;
    use base qw(Tk::BrowseEntry);
    use Tk::NumEntry;
    Construct Tk::Widget NumBrowseEntry;
    sub LabEntryWidget { "NumEntry" }


BrowseEntry should really provide more of the ComboBox options.


Rajappa Iyer

Chris Dean made additions.

More additions by Slaven Rezic

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.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 BROWSEENTRY (3) 2013-11-15

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.