From: rgm on
I have run into an issue with focus of an entry widget (it happens
with a text widget too) when using KDE 3.5 on Redhat 5 Linux.

The script below shows the issue. It creates a window that has an
entry and a label. If you click in the entry and type a few
characters every thing works as expected. Now if you move your mouse
over the label that says "Hover Here" a tooltip pops up -- you can
still type in the entry widget while it is up. As soon as you move
your mouse off of the label the tooltip is taken down and the entry
widget locks up. It looks like it still has the focus: the focus
highlight is still shown and the cursor is still blinking, but you
can't type in it. Clicking in the entry does not regain focus. The
only way to get the input focus back is to un-focus the window (by
clicking on another window) and then clicking in the window. Now the
entry works normally until you bring down the tooltip again.

This seems to work on an older version of KDE so I am suspecting it is
a bug in the window manager, however it could also be something with
the way Tcl handles focus. I tried this with both Tcl/Tk 8.4 and 8.5
with the same results.

Anyone have a clue on what I can do to fix this? Note if I hide the
tooltip window instead of destroy it, the problem does not happen. I
could do this but I suspect other things I have in my application will
cause the same issue.

----------------------------------------------------------------------------

entry .e
label .l -text "Hover here" -background red -foreground white

pack .e
pack .l -padx 5 -pady 5

bind .l <Enter> "_show %X %Y"
bind .l <Leave> _hide

proc _show {x y} {
catch {destroy .helpwin}
toplevel .helpwin -bg yellow -bd 1 -relief flat
wm overrideredirect .helpwin 1
wm transient .helpwin
wm withdraw .helpwin

label .helpwin.l -text "Hello There" -background yellow -
foreground black
pack .helpwin.l

update idletasks

if { [winfo exists .helpwin] } {
incr y 12
incr x 8
wm geometry .helpwin +$x+$y
update idletasks
if { [winfo exists .helpwin] } {
wm deiconify .helpwin
}
}
}

proc _hide {} {
catch {destroy .helpwin}
}
From: rgm on
Bump!! Has anyone seen this issue and found a workaround for it?

On Jul 16, 4:21 pm, rgm <rgm01...(a)yahoo.com> wrote:
> I have run into an issue with focus of an entry widget (it happens
> with a text widget too) when using KDE 3.5 on Redhat 5 Linux.
>
> The script below shows the issue.  It creates a window that has an
> entry and a label.  If you click in the entry and type a few
> characters every thing works as expected. Now if you move your mouse
> over the label that says "Hover Here" a tooltip pops up -- you can
> still type in the entry widget while it is up.  As soon as you move
> your mouse off of the label the tooltip is taken down and the entry
> widget locks up.  It looks like it still has the focus: the focus
> highlight is still shown and the cursor is still blinking, but you
> can't type in it.  Clicking in the entry does not regain focus. The
> only way to get the input focus back is to un-focus the window (by
> clicking on another window) and then clicking in the window.  Now the
> entry works normally until you bring down the tooltip again.
>
> This seems to work on an older version of KDE so I am suspecting it is
> a bug in the window manager, however it could also be something with
> the way Tcl handles focus.  I tried this with both Tcl/Tk 8.4 and 8.5
> with the same results.
>
> Anyone have a clue on what I can do to fix this?  Note if I hide the
> tooltip window instead of destroy it, the problem does not happen.  I
> could do this but I suspect other things I have in my application will
> cause the same issue.
>
> --------------------------------------------------------------------------- -
>
> entry .e
> label .l -text "Hover here" -background red -foreground white
>
> pack .e
> pack .l -padx 5 -pady 5
>
> bind .l <Enter> "_show %X %Y"
> bind .l <Leave> _hide
>
> proc _show {x y} {
>     catch {destroy .helpwin}
>     toplevel .helpwin -bg yellow -bd 1 -relief flat
>     wm overrideredirect .helpwin 1
>     wm transient .helpwin
>     wm withdraw .helpwin
>
>     label .helpwin.l -text "Hello There" -background yellow -
> foreground black
>     pack .helpwin.l
>
>     update idletasks
>
>     if { [winfo exists .helpwin] } {
>         incr y 12
>         incr x 8
>         wm geometry .helpwin +$x+$y
>         update idletasks
>         if { [winfo exists .helpwin] } {
>             wm deiconify .helpwin
>         }
>     }
>
> }
>
> proc _hide {} {
>     catch {destroy .helpwin}
>
>
>
> }

From: Donald Arseneau on
On Jul 28, 1:25 pm, rgm <rgm01...(a)yahoo.com> wrote:
> > I have run into an issue with focus of an entry widget (it happens
> > with a text widget too) when using KDE 3.5 on Redhat 5 Linux.

kdebase-3.5.4-21.el5_5.1.i386
tk-8.4.13-5.el5_1.1.i386

> > The script below shows the issue.  ...  As soon as you move
> > your mouse off of the label the tooltip is taken down and the entry
> > widget locks up.

The entry widget does not lock up for me.

What are your Kde settings for focus policy?

Donald Arseneau