FireBird34 has asked for the wisdom of the Perl Monks concerning the following question:
Given that code, how would I return the value of the selected item in the list? Tried some things, but I'm still new to Tk, and this is my first attempt on Tk::BrowseEntry. Any help would be greatly appreciated.#!/usr/bin/perl -w use strict; use Tk; use Tk::BrowseEntry; # Create the main window my $mw; $mw->{main} = MainWindow->new; # Create the browse entry $mw->{a} = $mw->{main}->BrowseEntry(-label => "Select one:")->pack; $mw->{a}->insert("end", "one"); $mw->{a}->insert("end", "two"); $mw->{a}->insert("end", "three"); my $frame = $mw->{main}->Frame()->pack(); $frame->Button(-text => "Ok", -command => \&return_value )->pack(-side => 'left'); $frame->Button(-text => "Exit", -command => sub{ $mw->{main}->destroy } )->pack(-side +=> 'left'); MainLoop; sub return_value { #return value of selected item here }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::BrowseEntry return value
by pg (Canon) on Apr 12, 2003 at 05:41 UTC | |
|
Re: Tk::BrowseEntry return value
by graff (Chancellor) on Apr 12, 2003 at 05:43 UTC | |
by FireBird34 (Pilgrim) on Apr 12, 2003 at 19:27 UTC |