Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hey monks

I have a weird thing going on for a few days now, and I can't seem to find the solution.

I have made a program on unix, using the Tk module. I will gave you the basic code you need to compile it and test it on your own.

This program is just 2 pages of a notebook widget. on the first page there are 2 big entry boxes with buttons aside. These I use to browse for files and save files. This is no problem.

but the entry "cell" gives me throubles. this is the smaller entry on the right of the screen.

When you click the button next, which i placed below the screen, I want to continue to page 2. Butt I only want to continue if the entry widget "cell" is not empty!

I have created a subroutine to check the state of the entry widget, but it always says the widget is empty...

So the mssgbox keeps popping up, eventhoug the entry "cell" is not empty.

I have tryd checking with "" as " " to be sure. nothing works.. I have been looking on it for days now.. Hope someone can help me! beneath is my code

use Tk; use Tk::LabFrame; use Tk::Dialog; $mw = MainWindow->new; $mw->geometry("1300x800"); $mw->title("Main window"); $nb = $mw->NoteBook( )->pack(-expand => 1, -fill => 'both'); ####### Create page 1 ########## $p1 = $nb->add('page1', -label => 'Input / Output'); $p1->Button(-text => 'Next', -width => '15', -height => '2', -command +=> \&go_page2,)->place( -x => 1100, -y =>620); $btBrowse = $p1->Button( -text => "Browse", -command => \&browse_file, )->place( -x => 450, -y => 105); $btSave = $p1->Button( -text => "Browse", -command => \&save_file, )->place( -x => 1180, -y => 105); $entrybrowse = $p1->Entry(-width => 60)->place( -x => 20, -y => 110); $entrysave = $p1->Entry(-width => 60)->place( -x => 750, -y => 110); $entry_cell = $p1->Entry(-width => 20)->place( -x => 850, -y => 200); ####### Create page 2 ########## $p2 = $nb->add('page2', -label => 'page2', -state=>'disabled'); MainLoop; sub go_page2 { $name_topcell = $entry_cell->get(); print $name_topcell, "\n"; if ($name_topcell == ""){ print "yes \n"; $mssg_empty = $p1->Dialog(-title => 'Fill in Values', -text => 'Please fill in all the values', -default_button => 'oke', -buttons => [ 'oke'], -bitmap => 'info' )->Show(); } else { $nb->pageconfigure('page2', -state => 'normal'); $nb->raise('page2'); } }

Many Thanks in advance


In reply to Checking state entry widget?! by jerre_111

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-18 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found