Hello monks,
how to disable the button untill certain fields are filled?
I want to display the 'pressme" button as disabled untill certain fields are filled in the table, and when these fields are filled, "pressme" button will become active.
how can i achieve this?
Any Ideas...
use strict;
use warnings;
use Tk;
use Tk::Table;
use Tk::Entry;
use Tk::Label;
my $mw = new MainWindow;
my $new_label = $mw -> Label(-text=>"Enter any character",
-foreground=>"red",
-font => "verdanafont 10 bold")
-> pack(-side=>"top");
my $table_frame = $mw->Frame()->pack(-padx=>"10");
our $table = $table_frame->Table(-columns => 4,
-rows => 5,
-scrollbars => "o",
-fixedrows => 1,
-fixedcolumns => 1,
-relief => 'raised',
-pady=>"20",
-takefocus=>"0");
my $press = $mw -> Button(-text=>"Press Me",
-command =>\\&PressMe,
-font => "verdanafont 10 bold")
-> pack(-side=>"left",-padx=>"5",
-ipadx=>"5");
my $row;
my $col;
for ($col=1;$col<5;$col++)
{
my $tmp_label=$table_frame->Label(-text=>"$col")->pack();
$table->put(0,$col,$tmp_label);
}
for($row=1;$row<6;$row++)
{
for ($col=1;$col<5;$col++)
{
my $ent1 = $table -> Entry(-font=>"verdana 10")
-> pack(-ipady=>"15");
$table->put($row,$col,$ent1);
}
}
$table->pack();
MainLoop;
sub PressMe
{
for($row=0;$row<5;$row++)
{
for ($col=0;$col<4;$col++)
{
my $name = $table->get($row,$col);
my $val = $name->get();
if ($val =~ m/[a-zA-Z0-9]/)
{
my $response=$mw -> messageBox(-type=>"ok", -message=>"alphanumeric en
+tered",-icon=>"info",-title=> "info!!");
}
}
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.