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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tk - entry box + autofocus

Status
Not open for further replies.

MatthewCallaghan

Programmer
Oct 19, 2006
2
CA
Hi there!

Glad to find a community for tk/tcl!

I'm hoping someone can help me with this...I'm sure it's very simple, but I can't seem to find the right command.

I'm looking for the command to AUTOFOCUS the "typing cursor" into an entry box.
(e.g. When one presses "Ctrl+F" in firefox, the find dialogue pops up, and typing immediately goes into the "Find:" entry box.)

So far I've tried :
Code:
$myEntryBox selection range 0 end
This simply highlights the text...but doesn't place the cursor in the box until the user clicks in it.

I've also tried:
Code:
$myEntryBox icursor 0
But this only works if there is text already in there...i'm starting with an empty entry box...

Does anyone know how I can do this?

Thank you very much for your time

~Matt
 
OH!

I found it.
Apparently focus commands aren't available to the widget itself, but from "focus".

SOLUTION:
Code:
focus $myEntryBox

Simple!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top