in reply to combobox in perl/Tk

Hi,

If your data in the list gets repeated, maybe you forget to delete the entries before you insert the new items?
The listbox used by Tk::BrowseEntry is a simple Tk::Listbox. It implements a tied interface which makes it possible to access and modify the Listbox content with simple array operations.
See Tk::Listbox,
Tk::BrowseEntry

use strict; use warnings; use Tk; my $mw = tkinit; my $be = $mw->BrowseEntry->pack; my $l = $be->Subwidget('slistbox')->Subwidget('scrolled'); my @content; tie @content,'Tk::Listbox', $l; @content = qw/apple banana orange /; $mw->Button(-text => 'change', -command => sub{ @content = qw/Paris Tokyo London /; }, )->pack; MainLoop();

update: added example


Cheers, Christoph

Replies are listed 'Best First'.
Re^2: combobox in perl/Tk
by listentome (Initiate) on Oct 08, 2009 at 09:25 UTC

    Hey Christoph, Thanks a ton. I wasted half a day on this!