My application runs this code at startup among other things:
set ::WidgetThatHasFocusNow [focus]
if {[string length $::WidgetThatHasFocusNow] <= 0} {
puts "focus is on [focus]"
}
output:
focus is on
That means no widget has focus at startup.What happens, when you insert a line with "update" or "update idletasks" before you query the current focus?
So I fixes it.
set WidgetThatHasFocusNow [focus]
if {[string length $::WidgetThatHasFocusNow] <= 0} {
focus -force $::FileListColumn
event generate $::FileListColumn <Up>
puts "focus is on [focus]"
} else {puts Eureka!}
output:
focus is on
No, it still doesn't work. :-(
But I also have this:
bind $::FileListColumn <Key> {after idle [list p.Update.Widgets.On.Any.Action %K]}
That prints/inserts the output of [focus] on a widget I keep around for debugging.
So that widget gets focus when I press any key, but not until then in spite of my efforts.
How can I force focus at startup programatically?
TIA
--
Luc
What happens, when you insert a line with "update" or "update idletasks" before you query the current focus?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 497 |
Nodes: | 16 (2 / 14) |
Uptime: | 10:17:03 |
Calls: | 9,781 |
Files: | 13,748 |
Messages: | 6,187,185 |