autoHilite and focus (following Jacque's solution)

Slava Paperno slava at lexiconbridge.com
Wed Jul 6 10:56:19 EDT 2011


Thanks, Ken--but I do want traversalOn to be true: that's the natural
behavior of a search field and the Find button:  type your target, then 

--click Find or
--press Enter or
--press Tab to focus on the Find button, then press Enter

That's why I have, at the bottom of the Find button's mouseUp script, this
command:

focus on field "SearchTarget" of this card

That command is followed, but only for a moment; the next moment the focus
jumps to the card itself. That's the part I'm struggling with. Why wouldn't
the field retain the focus if it is unlocked and its traversalOn is true?

I'm also trying to understand the logic of LC behavior so next time I don't
have to ask the list: you say "when the focus is in the field and you go to
click the button, the focus is shifting automatically to the button you
clicked because the "traversalOn" property is "true".  That's puzzling. I
would think that when you click a button, the focus shifts to it no matter
what (unless the button is disabled). Otherwise every button with a false
"traversalOn" property would be unclickable... no?

Gratefully,

Slava


> -----Original Message-----
> From: use-livecode-bounces at lists.runrev.com [mailto:use-livecode-
> bounces at lists.runrev.com] On Behalf Of Ken Ray
> Sent: Wednesday, July 06, 2011 8:42 AM
> To: How to use LiveCode
> Subject: Re: autoHilite and focus (following Jacque's solution)
> 
> 
> > With the focus gone, my user will probably try to press Tab to return
> > the focus to the input field. But when the focus is on the card, none
> > of my buttons receives that Tab keypress.
> >
> > Is there no way to achieve what I want (see first sentence of this
email)?
> 
> Slava, instead of turning the autoHilite off, you need to turn the
"traversalOn"
> off (what the Inspector shows as "Focus with keyboard"
> checkbox).
> 
> What's happening is that when the focus is in the field and you go to
click the
> button, the focus is shifting automatically to the button you clicked
because the
> "traversalOn" property is "true" by default for buttons. If you turn that
off, the
> button won't be *focusable*, but it will still automatically highlight
when clicked
> (assuming the "autoHilite" is "true").
> 
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list