Selecting text in single-line entry fields - small UI issue

Roland Huettmann roland.huettmann at gmail.com
Fri Jan 29 04:21:29 EST 2016


Paul, yes, autohilite does it. ) But nevertheless, to perform some action,
I need a trigger while tabbing.

I am using LC 7.1, Windows 8.1

The actual question was another one:

The text is highlighted - yes - in both cases.

But the single-line field rectangle is not, just the text itself.

I would like to have the visual effect showing a fully highlighted field
(not the text itself) where the text is visible and selected - and ideally
the color showing is set apart more than just 1 pixel from the border of
the field boundaries.

This simply looks better than a chunk of text being selected.

This can somehow be done tabbing into the field and then setting the
backgroundcolor of field.

But setting the backgroundcolor to the hilitecolor will make the text chunk
disappear.

Example:

// The text chunk only appears when tabbing out or deselecting it. Setting
the hilitecolor to empty does not make a difference. //

on tabkey
   set the hilitecolor of field "Test1" to blue
   set the backgroundcolor of field "Test1" to the hilitecolor of field
"Test1"
   select the text of field "Test1" // The text DISAPPEARS
end tabkey

One way of achieving the desired effect is with a trick:

Set the actual field to be transparent. Put a graphic or another control
(field..) behind. Selecting the text of the transparent field will change
the color of the control behind it and the visual effect will be as desired
if the hilitecolor is set to the same color as the backgroundcolor in the
control behind.

But of course - this is not something I would like to do for all my fields.
)

Roland







On 28 January 2016 at 22:26, Paul Hibbert <paul at livecode.org> wrote:

> On Jan 28, 2016, at 4:07 AM, Roland Huettmann <roland.huettmann at gmail.com>
> wrote:
> >
> > Maybe I am missing something, but I need to script this with "on
> > tabkey"-event handlers, "on textchanged" handlers, " on deletekey"
> handlers
> > and go with "select the text of..." or "select line 1 of...". Otherwise
> the
> > cursor is always placed behind the text - and I do not want that except
> for
> > multi-line fields. Could there not be a built-in attribute how selection
> > should occur?
>
> Check the autoTab property in the inspector, or if you want to set it by
> script…
>
> set the autoTab of field “myField" to true
>
> I’m not seeing any issue with text changing colour when selected, but you
> didn’t say which version of Livecode or which platform you are seeing this
> on, this info may help track down the problem.
>
> Paul
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list