in reply to better control of Tk::Button
You can disable the Button from inside the -command callback like so:
use strict; use warnings; use Tk; require Tk::BrowseEntry; ######################### #Hitting the button casuses many instances of listBrowse widget ######################## my $listButton; my $main= MainWindow->new(); $listButton=$main->Button( -text=> 'list', -height=> 2, -width=> 10, -relief=> 'ridge', -command=> sub{listBrowse(); $listButton->configure(-state => 'disabled'); }, )->pack(); my $choice="number"; #the default list item. sub listBrowse{ my $listTag=$main->BrowseEntry( -variable=>\$choice, -browsecmd=>\&Verify )->pack(); $listTag->insert("end","Number"); $listTag->insert("end","Bullet"); } MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: better control of Tk::Button
by SuicideJunkie (Vicar) on Oct 07, 2009 at 14:13 UTC | |
by lamprecht (Friar) on Oct 07, 2009 at 18:17 UTC |