From: Steven <ste...@ya...> - 2011-09-09 00:05:26
|
With multi window apps, a friend has been lamenting having to click twice when switching between windows (ie - one click to get focus, another click to activate a widget), which is unlike on Linux and Windows. I tried declaring secondary toplevels as transient, but to no avail. ... So now my only idea is an ugly hack like what i've outline below. We collect the FocisIn click, and generate an extra Button event at the same window location. I havent written anything yet. Has anyone successfully tried this, or worked around the "have to click twice" issue in some other way ? Perhaps it's possible with an Operating System tweak, or even a custom compilation of Tcl, which we already include with our App (http://scidvspc.sf.net) because of problems with Snow Leopard's Wish 8.5.7. Cheers, Steven Atkinson --------------------------------------- # Try to catch focus-in button press, and pass to widget # (rough outline only) rename toplevel tk_toplevel proc toplevel {w args} { tk_toplevel $w $args bind $w <FocusIn> {GenerateExtraClick %W %x %y} } proc GenerateExtraClick {w x y} { if {[focus was achieved with button click ?]} { event generate $w <Button-1> -button 1 -rootx $x -rooty $y } # May-be necessary ? bind $w <FocusIn> {} bind $w <FocusOut> { bind $w <FocusIn> {Generate_extra_click %W %x %y} } } |