Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Clearing and entry-box in TK

by strat (Canon)
on Sep 23, 2006 at 10:08 UTC ( #574497=note: print w/replies, xml ) Need Help??


in reply to Clearing an entry-box in TK

You could work with -textvariable (instead of -text) which binds a reference to a variable to the content of the entry, e.g

use vars qw($InputText); $InputText = ""; ... my $input = $mw->Entry (-textvariable => \$InputText)->form; ... # my $guess = int ($input->get); my $guess = int( $InputText ); $InputText = ""; # empty it

Another Idea: If you just want to allow integer values to be entered, it often is a good way not to allow other input than numbers which makes errorchecking easier. Maybe Tk::NumEntry could be interesting for you, or my Tk::EntryCheck, e.g.

my $input = $mw->EntryCheck( -textvariable => \$InputText, -pattern => qr~\d~, )->form;

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Replies are listed 'Best First'.
Re^2: Clearing and entry-box in TK
by Panda (Scribe) on Sep 24, 2006 at 01:57 UTC
    Thanks strat, I'll get GrandFather to download Tk::EntryCheck so I can try the game using it as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://574497]
help
Chatterbox?
[LanX]: you will Theodi-see!
[Eily]: congrats choroba :)
[Discipulus]: choroba i made you Bishop !!
[choroba]: 9999 points until level 23 - Archbishop.
[LanX]: darn trying to downvote him again fails ... ;-P
[Discipulus]: congrats!
[LanX]: His Excelleny Choroba will now nbe clothed in his new robe ...
[Discipulus]: bishop ship sheeps in the shop..
[1nickt]: Discipulus too easy!
[1nickt]: "The sixth sheik's sixth sheep's sick" (if you are after 'sh' tongue twisters)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-09-26 12:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (294 votes). Check out past polls.

    Notices?