in reply to Checking state entry widget?!
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::LabFrame; use Tk::Dialog; use Tk::NoteBook; sub go_page2 { warn "<<@_>>"; my ($nb, $entry_cell) = @_; my $name_topcell = $entry_cell->get; print $name_topcell, "\n"; if ($name_topcell eq q()){ print "yes \n"; my $mssg_empty = $nb->Dialog(-title => 'Fill in Value +s', -text => 'Please fill i +n all the values', -default_button => 'oke', -buttons => [ 'oke'], -bitmap => 'info', )->Show; } else { $nb->pageconfigure('page2', -state => 'normal'); $nb->raise('page2'); } } my $mw = MainWindow->new(-title => 'Main window'); $mw->geometry('1300x800'); my $nb = $mw->NoteBook->pack(-expand => 1, -fill => 'both'); ####### Create page 1 ########## my $entry_cell; # To be sent to go_page2. my $p1 = $nb->add('page1', -label => 'Input / Output'); $p1->Button(-text => 'Next', -width => 15, -height => 2, -command => sub { go_page2($nb, $entry_cell) }, )->place( -x => 1100, -y =>620); my $btBrowse = $p1->Button(-text => 'Browse', -command => \&browse_file, )->place( -x => 450, -y => 105); my $btSave = $p1->Button(-text => 'Browse', -command => \&save_file, )->place( -x => 1180, -y => 105); my $entrybrowse = $p1->Entry(-width => 60)->place( -x => 20, -y => 11 +0); my $entrysave = $p1->Entry(-width => 60)->place( -x => 750, -y => 11 +0); $entry_cell = $p1->Entry(-width => 20)->place( -x => 850, -y => 20 +0); ####### Create page 2 ########## my $p2 = $nb->add('page2', -label => 'page2', -state => 'disabled'); MainLoop();
Note that the user can still fill in the box (which probably should have a label of some sort), activate page 2, return back to page 1, clear the box and return to page 2 by clicking on its tab.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Checking state entry widget?!
by jerre_111 (Sexton) on May 03, 2013 at 10:56 UTC |