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!

[focus] doesn't show the actually selected window

Status
Not open for further replies.

firelex

Programmer
Jan 10, 2002
118
DE
Hi, all!
Can anybody tell me how does it work with the focus?
It's crazy, but I can't set it! There is a command
Code:
focus
window-name
to set the focus to window. But it doesn't work!

I (try to) set the focus at the beginning of my prog and then try to check if
it was set with
Code:
[focus]
up to the end of the start procs,
before the event loop begins. The result is always - nothing.

Sorry I can't give any example - the prog is too long.

The point is - does anybody know if there are any other things that
influence the focus setting?

(
Code:
focus -force
and
Code:
update
doesn't work as well)

Thanks a lot.
 
To effectively see the blinking cursor, you need to declare a widget to be focused inside the toplevel:
Code:
  wm title . root
  toplevel .top
  pack [entry .top.e1]
  pack [entry .top.e2]
  pack [entry .e]
  focus .
  update
  # . has focus
  after 2000
  focus .e
  update
  # .e has focus
  after 2000
  focus .top
  update
  # .top has focus
  after 2000
  focus .top.e2
  # .top.e2 has focus
HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top