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

J. Landman Gay jacque at hyperactivesw.com
Fri Jan 29 11:16:40 EST 2016


The focusborder property will outline the currently active field with a color. If you use that, you won't have to set the field's backcolor. 

If you do want to script the behavior, you can use either the openfield or focusIn message as the trigger. When focus is lost, a focusOut message is sent as well as either closefield or exitfield, which you can use to reset the field appearance. 

I've had to work around the disappearing selection text on Windows before (it doesn't happen on Mac) and found that for black text, the best background color is a pale shade. I think I used a very light yellow. 

On January 29, 2016 3:21:29 AM CST, Roland Huettmann <roland.huettmann at gmail.com> wrote:
>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
>_______________________________________________
>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

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list