Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TK - make frame in focus

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Joined
Feb 6, 2002
Messages
1,851
Location
IL
HI,

I need to make the folowing frame in focus (ot top of all windows) and the cursor to be inside the password entry.

$loginwin->Label(-text => 'Enter your password to continue:')->pack(-side=>'top');
my $passEntry = $loginwin->Entry (-show=>'*',-width =>10,-background=>'white',
-textvariable =>\$password)->pack(-side=>'left',-pady=>3);
my $submitBttn = $loginwin->Button (-text => 'Log In',
-command =>sub{&confirm})->pack(-side=>'right',-pady=>3);
$loginwin->bind('<Return>'=>sub{&confirm});

Appreciate any recommendations.
Thanks

Long live king Moshiach !
 
Use focusForce to put focus into the text box. Either call $passEntry->focusForce or put it at the end of pack if you wanna be compact with it.

Code:
$passEntry->focusForce;

# --or--

my $passEntry = $loginwin->Entry (-show=>'*',-width =>10,-background=>'white',
                -textvariable =>\$password)->pack(-side=>'left',-pady=>3)[COLOR=blue]->focusForce[/color];

As for having the window stay on top of other windows... the best you can do is have it be on top of your other Tk windows. I've never yet found a way to make it "always on top" for every window you have open.

But, I'm assuming the code you're using is the one we helped you with before, and your MainWindow is invisible until the right password has been entered. So in this case, there's not much you can do.

If your MainWindow was visible, you could create the password box as a DialogBox, which would make it stay on top of your MainWindow, but not stay on top of other application windows.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top