listmail wrote:
below is a password entry dialog example. I'd like to know if it is possible to only have to press tab once
(after typing the username) in order to have focus on the password field ??
~~~~~~~~~~~~~~~~~~~~~~~~~~
How about:
#! /usr/bin/perl -w
use strict;
use warnings;
use Tk;
use Tk::DialogBox;
use Tk::LabEntry;
my ($username, $password);
my $top = MainWindow->new();
# for keyboarders, no extra charge
$top->bind( '<Escape>', sub { exit; } );
my $db = $top->DialogBox(-title => 'Login',
-buttons => ['Ok', 'Cancel'],
-default_button => 'Ok');
$db->Label( -text=>'Username:')->
pack( my $uname = $db->Entry( -textvariable=>\$username, -width=>20)
, -side=>'left');
$db->Label( -text=>'Password:')->
pack( $db->Entry( -textvariable=>\$password, -width=>20, -show=>'*')
, -side=>'left');
$uname->focus;
my $answer = $db->Show();
print "User=$username, pwd=$password, Answer=$answer\n";
exit(1) if $answer eq 'Cancel';
MainLoop();
--
pDale
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs