[BUG][Q]Selection behavior in textmorphs

Hernan Tylim htylim at yahoo.com.ar
Wed Mar 10 01:57:52 UTC 2004


Hi. 

Not a very long time ago I was playing with this stuff. In that time
what I understood from reading the code was that the text cursor is a
selection interval of length 0. So I supposed that to hide the text
cursor when there wasn't keyboard focus was the reason to nil the
selection when the mouse leaves the textmorph.

Note that TextMorph directly nils the selection when it release it's
editor. (check #releaseEditor). It is PluggableTextMorph who remembers
the selectionInterval in #mouseLeave: and restore it again on
#mouseEnter:.

My personal opinion is that the text cursor is the visual representation
of keyboard focus. So I think that hiding the selection is the right
thing to do. What it isn't maybe necessary is to lose the keyboard focus
when the mouse leaves. For this last thing I did
clickForKeyboardFocus.cs which is on SM. 

Hope this helps.

Also. Please remember that this is only my understanding from reading
the code, so there is a big-chance that what I just said to you was
totally wrong. :) 

(by the way, the completion package rocks!) 

Regards,
Hernán

> -----Mensaje original-----
> De: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] En nombre de rrobbes
> Enviado el: Martes, 09 de Marzo de 2004 07:50 p.m.
> Para: squeak-dev at lists.squeakfoundation.org
> Asunto: [BUG][Q]Selection behavior in textmorphs
> 
> 
> Hi all,
> 
> There's an annoying problem with the way selection works in textmorphs
:
> when the mouse leaves the textmorph (ie it looses focus),
> the selection disappears, and therefore cannot be used.
> This can be quite annoying, I recall that a while ago I posted
> a simple fix to allow menus in textmorphs to be keyboard-driven,
> but this fix was flawed when menu items who needed the selection
> were triggered, as the textmorph selection was lost in the meantime.
> 
> Today I looked further at the problem and noticed that
PluggableTextMorph
> had an instance variable named selectionInterval which is strangely
used
> (get/set code follow)
> 
> selectionInterval
> ^ textMorph editor selectionInterval
> 
> selectionInterval: i
>  selectionInterval := i
> 
> So when the morph loses focus, a call to selectionInterval returns
> (1 to: 0), but the instance variable yields the correct answer
> (ie (15 to: 18) for example).
> 
> Is there a reason for this odd behavior ?
> If not, I'll post tomorrow a [FIX] for this and to allow
> real keybord control in PluggableTextMorphs.
> 
>    Romain




More information about the Squeak-dev mailing list