noelgolding has asked for the wisdom of the Perl Monks concerning the following question:
This is my first post, so please be gentle if I have made any noob mistakes :)
I have found a post that attempts to tackle this problem, but the solutions provided are not very simple, or complete.
see Using Tk::Text and '<<Modified>>'
I need:
I am looking for something as simple as (or as close as possible):
#!/usr/local/bin/perl use warnings; use strict; use Tk; # Global variables my $entry_val; # Main Window my $mw = new MainWindow; $mw->Entry( -validate=>"all", -validatecommand=>\&handleEvent, -textvariable=>\$entry_val, )->pack(); MainLoop; # Callbacks sub handleEvent { my ($new_val, $chars_2_change, $curr_val, $index, $action) = @_; # do nothing if No Change and No Force Validate if (!$chars_2_change && $action != -1){ return; } # do something meaningful here. # for now, just print the $new_val print $new_val."\n"; }
While the above code works great, it only satisfies 2 out of my 3 requirements. I am hoping that I have missed a widget that provides this functionality simply, or some option(s) of Entry that I may have overlooked to provide scrollable multi-line support.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using TK Text (or something similar), is there a simple way to get the -validate=>"all" functionality in TK Entry?
by Khen1950fx (Canon) on Jun 20, 2011 at 01:30 UTC | |
|
Re: using TK Text (or something similar), is there a simple way to get the -validate=>"all" functionality in TK Entry?
by zentara (Cardinal) on Jun 20, 2011 at 11:36 UTC | |
|
Re: using TK Text (or something similar), is there a simple way to get the -validate=>"all" functionality in TK Entry?
by Anonymous Monk on Jun 20, 2011 at 09:18 UTC |