Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Checking state entry widget?!

by choroba (Abbot)
on May 03, 2013 at 10:30 UTC ( #1031853=note: print w/ replies, xml ) Need Help??


in reply to Checking state entry widget?!

Moreover, your code does not use warnings and strict. You are happily using variables in go_page2 that come from the main programme body. Consider a cleaner version of the code:

#!/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.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Checking state entry widget?!
Download Code
Re^2: Checking state entry widget?!
by jerre_111 (Sexton) on May 03, 2013 at 10:56 UTC

    Thanks for your advice!! it works now ;).

    Normally I put a label next to the entry widget. this is just a quick copy paste from the original program just so you could run and compile the test program to understand my problem.

    Thank you very much!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031853]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-09-17 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls