>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 ??
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~
>#! /usr/bin/perl -w
>use strict;
>use Tk;
>
>my ($username, $password);
>
>my $top = MainWindow->new();
>
>my $db = $top->DialogBox(-title => 'Login', -buttons => ['Ok',
'Cancel'],
>                         -default_button => 'Ok');
>
>my $login=$db->add('LabEntry', -textvariable => \$username, -width =>
20,
>                   -label => 'Username',
>                   -labelPack => [-side => 'left'],
>                   -takefocus => 0)->pack;
>
>$db->add('LabEntry', -textvariable => \$password, -width => 20,
>                     -label => 'Password', -show => '*',
>                     -labelPack => [-side => 'left'],
>                     -takefocus => 1)->pack;
>
>$login->focus;
>my $answer = $db->Show();
>
>Mainloop();
>
>
>_______________________________________________

It appears you can't change the tab order, since you've created a
DialogBox. The DialogBox automatically creates a button (if you remove
all but the title attribute, you'll still get an 'Ok' button...). It
means that the Ok button will be the first tab order. Every other widget
you put will come AFTER that. When you force the focus on the $login you
manipulate the focus, but the next tab stop is still the first one to
begin with (the button).

You may try to avoid that by creating a simple window (not a dialog box)
and then you can insert the widgets in your own fashion (and order).

>From the little I tried to toy with it, I still couldn't get it right. I
think it's got to do with the LabEntry widget as well.

HTH


All the best,

Schichmanter Eitan
SDM Team Developer,
Petah-Tikva, Israel
Intel(r) 
[EMAIL PROTECTED]
phone: +972-3-9207046
------------------------------
 
Schichmanter Eitan,
CM Consultant and Developer,
LMB-Consulting LTD.
[EMAIL PROTECTED]
www.lmb.co.il


_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to